crypto/gc-sha1 tests: Improve output when the test fails.
authorBruno Haible <bruno@clisp.org>
Sat, 24 Aug 2019 15:28:48 +0000 (17:28 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 24 Aug 2019 15:28:48 +0000 (17:28 +0200)
* tests/test-gc-sha1.c (main): In case of mismatch, print the entire
output.

ChangeLog
tests/test-gc-sha1.c

index b126ba9a340de54bb33fa82b2752c2898ae97c4f..53e5b25a1dea11b1c3c1b8eed85f7b03a68f4cb3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-08-24  Bruno Haible  <bruno@clisp.org>
+
+       crypto/gc-sha1 tests: Improve output when the test fails.
+       * tests/test-gc-sha1.c (main): In case of mismatch, print the entire
+       output.
+
 2019-08-24  Bruno Haible  <bruno@clisp.org>
 
        crypto/gc-sm3: Fix compilation error with --with-libgcrypt.
index dcfebbd17dbb0b197ee7460565647af2c927e816..ac97fa16de8448fe730cc0e85b0f06872991d6ee 100644 (file)
@@ -52,11 +52,11 @@ main (int argc, char *argv[])
     if (memcmp (out, expect, 20) != 0)
       {
         size_t i;
-        printf ("sha1 mismatch. expected:\n");
-        for (i = 0; i < 16; i++)
+        printf ("sha1 test1 mismatch. expected:\n");
+        for (i = 0; i < 20; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (i = 0; i < 20; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -72,11 +72,11 @@ main (int argc, char *argv[])
     if (memcmp (out, expect, 20) != 0)
       {
         size_t i;
-        printf ("sha1' mismatch. expected:\n");
-        for (i = 0; i < 16; i++)
+        printf ("sha1 test2 mismatch. expected:\n");
+        for (i = 0; i < 20; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (i = 0; i < 20; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -107,7 +107,7 @@ main (int argc, char *argv[])
     if (memcmp (p, expect, 20) != 0)
       {
         size_t i;
-        printf ("sha1 1 mismatch. expected:\n");
+        printf ("sha1 test3 mismatch. expected:\n");
         for (i = 0; i < 20; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");