From 06ba5700871cfae584c604dafa93a3e3a4f23048 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 24 Aug 2019 17:28:48 +0200 Subject: [PATCH] crypto/gc-sha1 tests: Improve output when the test fails. * tests/test-gc-sha1.c (main): In case of mismatch, print the entire output. --- ChangeLog | 6 ++++++ tests/test-gc-sha1.c | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index b126ba9a34..53e5b25a1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2019-08-24 Bruno Haible + + 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 crypto/gc-sm3: Fix compilation error with --with-libgcrypt. diff --git a/tests/test-gc-sha1.c b/tests/test-gc-sha1.c index dcfebbd17d..ac97fa16de 100644 --- a/tests/test-gc-sha1.c +++ b/tests/test-gc-sha1.c @@ -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"); -- 2.39.5