From d3421a49378fcbadee1dd6bf2288f2b7bf4d02bb Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Thu, 28 Oct 1999 21:58:51 +0000 Subject: [PATCH] change the test case. apparently we should not include $ after the salt. also make it print more useful stuff when failing. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7275 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/des/md5crypt_test.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/des/md5crypt_test.c b/lib/des/md5crypt_test.c index 9afca5cd1..a20442099 100644 --- a/lib/des/md5crypt_test.c +++ b/lib/des/md5crypt_test.c @@ -50,7 +50,7 @@ struct test { const char *salt; const char *result; } tests[] = { - {"Hello world!", "$1$saltstring", "$1$saltstri$YMyguxXMBpd2TEZ.vS/3q1"}, + {"Hello world!", "$1$saltstring", "$1$saltstriYMyguxXMBpd2TEZ.vS/3q1"}, {NULL, NULL, NULL} }; @@ -60,9 +60,17 @@ do_test (void) struct test *t; int res = 0; - for (t = tests; t->str != NULL; ++t) - if (strcmp (crypt (t->str, t->salt), t->result) != 0) + for (t = tests; t->str != NULL; ++t) { + const char *c; + + c = crypt (t->str, t->salt); + + if (strcmp (c, t->result) != 0) { res = 1; + printf ("should have been: \"%s\"\n", t->result); + printf ("result was: \"%s\"\n", c); + } + } if (res) printf ("failed\n"); else