Commit 191025ff authored by Alexander Camatchy's avatar Alexander Camatchy
Browse files

ajout fichier test

parent 68c8b472
Loading
Loading
Loading
Loading
+15 −0
Changes for tests/bignum_tests.c: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -35,11 +35,26 @@ void test_str(){
  printf("test_str OK\n");
}

void test_from_md5(){
  bignum_t t, tt;
  unsigned char digest[MD5_DIGEST_LENGTH];
  char x[] = "coucou";
  char xx[] = "719d8179d0cea7774b518d58fd52fc4";
  MD5((const unsigned char*)x, 7, digest);
  t = bignum_from_MD5(digest, MD5_DIGEST_LENGTH);
  tt = bignum_from_str(xx, 16);
  
  assert(bignum_eq(t, tt));
  
  printf("test_from_md5 OK\n");
}

int main(){
  printf("=== BIGNUM tests ===\n");
  test_arithmetic();
  test_cmp();
  test_str();
  test_from_md5();

  return 0;
}