Changeset 9be80b5 for tester.c


Ignore:
Timestamp:
Feb 9, 2010, 9:49:49 PM (15 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.10, release-1.6, release-1.7, release-1.8, release-1.9
Children:
1f37eba
Parents:
ae50abc
git-author:
Anders Kaseorg <andersk@mit.edu> (02/07/10 23:16:45)
git-committer:
Anders Kaseorg <andersk@mit.edu> (02/09/10 21:49:49)
Message:
zcrypt: Add tests.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Nelson Elhage <nelhage@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tester.c

    rf7cd7c9 r9be80b5  
    1313int owl_obarray_regtest(void);
    1414int owl_editwin_regtest(void);
     15#ifdef OWL_ENABLE_ZCRYPT
     16int owl_zcrypt_regtest(void);
     17#endif
    1518
    1619int main(int argc, char **argv, char **env)
     
    3336  numfailures += owl_obarray_regtest();
    3437  numfailures += owl_editwin_regtest();
     38#ifdef OWL_ENABLE_ZCRYPT
     39  numfailures += owl_zcrypt_regtest();
     40#endif
    3541  if (numfailures) {
    3642      fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures);
     
    361367  return numfailed;
    362368}
     369
     370#ifdef OWL_ENABLE_ZCRYPT
     371int owl_zcrypt_regtest(void)
     372{
     373  int numfailed = 0;
     374  char *encrypted, *decrypted;
     375
     376  printf("# BEGIN testing owl_zcrypt\n");
     377
     378  encrypted = owl_zcrypt_encrypt_with_key("Hello, world!", "seekritkey");
     379  FAIL_UNLESS("zcrypt encrypt", strcmp(encrypted, "TLJMKQSIGKSJRIJRSIIPIJFFULKRJSPK") == 0);
     380  decrypted = owl_zcrypt_decrypt_with_key(encrypted, "seekritkey");
     381  FAIL_UNLESS("zcrypt decrypt", strcmp(decrypted, "Hello, world!") == 0);
     382  owl_free(decrypted);
     383  owl_free(encrypted);
     384
     385  printf("# END testing owl_zcrypt (%d failures)\n", numfailed);
     386
     387  return numfailed;
     388}
     389#endif
Note: See TracChangeset for help on using the changeset viewer.