changeset 6396:c5a9572c5a91

Add tests.
author Simon Josefsson <simon@josefsson.org>
date Tue, 18 Oct 2005 23:45:03 +0000
parents 6777a0214f5d
children e8f85e14ec8b
files ChangeLog tests/test-gc-md4.c tests/test-gc-md5.c
diffstat 3 files changed, 43 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- a/tests/test-gc-md4.c
+++ b/tests/test-gc-md4.c
@@ -66,6 +66,25 @@
 	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 ();
--- a/tests/test-gc-md5.c
+++ b/tests/test-gc-md5.c
@@ -66,6 +66,25 @@
 	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 ();