Add tests.
authorSimon Josefsson <simon@josefsson.org>
Tue, 18 Oct 2005 23:45:03 +0000 (23:45 +0000)
committerSimon Josefsson <simon@josefsson.org>
Tue, 18 Oct 2005 23:45:03 +0000 (23:45 +0000)
ChangeLog
tests/test-gc-md4.c
tests/test-gc-md5.c

index da47feb..5e301fa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2005-10-19  Simon Josefsson  <jas@extundo.com>
 
+       * tests/test-gc-md4.c, tests/test-gc-md5.c: Test gc_hash_buffer
+       interface too.
+
+2005-10-19  Simon Josefsson  <jas@extundo.com>
+
        * modules/gc-md4, modules/gc-md4-tests: New file.
 
        * tests/test-gc-md4.c: New file.
index bb4dbb2..67621a6 100644 (file)
@@ -66,6 +66,25 @@ main (int argc, char *argv[])
        printf ("\n");
        return 1;
       }
+
+    if (gc_hash_buffer (GC_MD4, in, inlen, out) != 0)
+      {
+       printf ("gc_hash_buffer(MD4) call failed\n");
+       return 1;
+      }
+
+    if (memcmp (out, expect, 16) != 0)
+      {
+       size_t i;
+       printf ("md4 1 missmatch. expected:\n");
+       for (i = 0; i < 16; i++)
+         printf ("%02x ", expect[i] & 0xFF);
+       printf ("\ncomputed:\n");
+       for (i = 0; i < 16; i++)
+         printf ("%02x ", out[i] & 0xFF);
+       printf ("\n");
+       return 1;
+      }
   }
 
   gc_done ();
index 6aadc56..5483517 100644 (file)
@@ -66,6 +66,25 @@ main (int argc, char *argv[])
        printf ("\n");
        return 1;
       }
+
+    if (gc_hash_buffer (GC_MD5, in, inlen, out) != 0)
+      {
+       printf ("gc_hash_buffer(MD5) call failed\n");
+       return 1;
+      }
+
+    if (memcmp (out, expect, 16) != 0)
+      {
+       size_t i;
+       printf ("md5 1 missmatch. expected:\n");
+       for (i = 0; i < 16; i++)
+         printf ("%02x ", expect[i] & 0xFF);
+       printf ("\ncomputed:\n");
+       for (i = 0; i < 16; i++)
+         printf ("%02x ", out[i] & 0xFF);
+       printf ("\n");
+       return 1;
+      }
   }
 
   gc_done ();