Changeset 19b2766


Ignore:
Timestamp:
Mar 1, 2010, 8:33:48 PM (10 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
release-1.5
Children:
ccfa7d1
Parents:
c4b5de8
git-author:
Anders Kaseorg <andersk@mit.edu> (02/07/10 23:16:45)
git-committer:
Nelson Elhage <nelhage@mit.edu> (03/01/10 20:33:48)
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

    rf0f2eec r19b2766  
    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)
     
    3134  numfailures += owl_obarray_regtest();
    3235  numfailures += owl_editwin_regtest();
     36#ifdef OWL_ENABLE_ZCRYPT
     37  numfailures += owl_zcrypt_regtest();
     38#endif
    3339  if (numfailures) {
    3440      fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures);
     
    355361  return numfailed;
    356362}
     363
     364#ifdef OWL_ENABLE_ZCRYPT
     365int owl_zcrypt_regtest(void)
     366{
     367  int numfailed = 0;
     368  char *encrypted, *decrypted;
     369
     370  printf("# BEGIN testing owl_zcrypt\n");
     371
     372  encrypted = owl_zcrypt_encrypt_with_key("Hello, world!", "seekritkey");
     373  FAIL_UNLESS("zcrypt encrypt", strcmp(encrypted, "TLJMKQSIGKSJRIJRSIIPIJFFULKRJSPK") == 0);
     374  decrypted = owl_zcrypt_decrypt_with_key(encrypted, "seekritkey");
     375  FAIL_UNLESS("zcrypt decrypt", strcmp(decrypted, "Hello, world!") == 0);
     376  owl_free(decrypted);
     377  owl_free(encrypted);
     378
     379  printf("# END testing owl_zcrypt (%d failures)\n", numfailed);
     380
     381  return numfailed;
     382}
     383#endif
Note: See TracChangeset for help on using the changeset viewer.