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 da47feb1fb09d39e2f6a0e38a76daa83b0bb4844..5e301faa7633d962b9a903ebca5942e6919b7d06 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+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.
index bb4dbb2bebb391d040f542be6eba3302b7a7f886..67621a66c12ab68804756e6ae81e382e98d3ebab 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 6aadc567b6e169d79a1a9b312948b59c21879922..54835173cb12c898d7dfef2719a377bb08e3ad71 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 ();