Mercurial > gnulib
changeset 39712:250d25415d0e
af_alg tests: Add another test.
* tests/test-digest.h (test_digest_on_files): Also check a large file
with a skipped header.
* tests/test-md5.c: Include macros.h.
* tests/test-sha1.c: Likewise.
* tests/test-sha256.c: Likewise.
* tests/test-sha512.c: Likewise.
* modules/crypto/md5-tests (Files): Add tests/macros.h.
* modules/crypto/sha1-tests (Files): Likewise.
* modules/crypto/sha256-tests (Files): Likewise.
* modules/crypto/sha512-tests (Files): Likewise.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 25 Jun 2018 01:02:39 +0200 |
parents | e693c621c472 |
children | a1f7596fe3e9 |
files | ChangeLog modules/crypto/md5-tests modules/crypto/sha1-tests modules/crypto/sha256-tests modules/crypto/sha512-tests tests/test-digest.h tests/test-md5.c tests/test-sha1.c tests/test-sha256.c tests/test-sha512.c |
diffstat | 10 files changed, 37 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Jun 24 15:15:16 2018 -0700 +++ b/ChangeLog Mon Jun 25 01:02:39 2018 +0200 @@ -1,3 +1,17 @@ +2018-06-24 Bruno Haible <bruno@clisp.org> + + af_alg tests: Add another test. + * tests/test-digest.h (test_digest_on_files): Also check a large file + with a skipped header. + * tests/test-md5.c: Include macros.h. + * tests/test-sha1.c: Likewise. + * tests/test-sha256.c: Likewise. + * tests/test-sha512.c: Likewise. + * modules/crypto/md5-tests (Files): Add tests/macros.h. + * modules/crypto/sha1-tests (Files): Likewise. + * modules/crypto/sha256-tests (Files): Likewise. + * modules/crypto/sha512-tests (Files): Likewise. + 2018-06-24 Pádraig Brady <P@draigBrady.com> maint: clarify comments about sticky EOF
--- a/modules/crypto/md5-tests Sun Jun 24 15:15:16 2018 -0700 +++ b/modules/crypto/md5-tests Mon Jun 25 01:02:39 2018 +0200 @@ -3,6 +3,7 @@ tests/test-digest.h tests/bench-md5.c tests/bench-digest.h +tests/macros.h Depends-on: getrusage
--- a/modules/crypto/sha1-tests Sun Jun 24 15:15:16 2018 -0700 +++ b/modules/crypto/sha1-tests Mon Jun 25 01:02:39 2018 +0200 @@ -3,6 +3,7 @@ tests/test-digest.h tests/bench-sha1.c tests/bench-digest.h +tests/macros.h Depends-on: getrusage
--- a/modules/crypto/sha256-tests Sun Jun 24 15:15:16 2018 -0700 +++ b/modules/crypto/sha256-tests Mon Jun 25 01:02:39 2018 +0200 @@ -4,6 +4,7 @@ tests/bench-sha224.c tests/bench-sha256.c tests/bench-digest.h +tests/macros.h Depends-on: getrusage
--- a/modules/crypto/sha512-tests Sun Jun 24 15:15:16 2018 -0700 +++ b/modules/crypto/sha512-tests Mon Jun 25 01:02:39 2018 +0200 @@ -4,6 +4,7 @@ tests/bench-sha384.c tests/bench-sha512.c tests/bench-digest.h +tests/macros.h Depends-on: getrusage
--- a/tests/test-digest.h Sun Jun 24 15:15:16 2018 -0700 +++ b/tests/test-digest.h Mon Jun 25 01:02:39 2018 +0200 @@ -25,7 +25,7 @@ int pass; unlink (TESTFILE); - for (pass = 0; pass < 4; pass++) + for (pass = 0; pass < 5; pass++) { { FILE *fp = fopen (TESTFILE, "wb"); @@ -39,14 +39,18 @@ case 0: /* Nothing to do for the empty file. */ break; + case 2: + /* Fill the small file, with some header that will be skipped. */ + fputs ("ABCD", fp); + FALLTHROUGH; case 1: /* Fill the small file. */ fputs ("The quick brown fox jumps over the lazy dog.\n", fp); break; - case 2: - /* Fill the small file, with some header that will be skipped. */ - fputs ("ABCDThe quick brown fox jumps over the lazy dog.\n", fp); - break; + case 4: + /* Fill the large file, with some header that will be skipped. */ + fputs ("ABCD", fp); + FALLTHROUGH; case 3: /* Fill the large file (8 MiB). */ { @@ -80,7 +84,7 @@ { case 0: expected = expected_for_empty_file; break; case 1: case 2: expected = expected_for_small_file; break; - case 3: expected = expected_for_large_file; break; + case 3: case 4: expected = expected_for_large_file; break; default: abort (); } @@ -93,6 +97,7 @@ switch (pass) { case 2: + case 4: { char header[4]; if (fread (header, 1, sizeof (header), fp) != sizeof (header))
--- a/tests/test-md5.c Sun Jun 24 15:15:16 2018 -0700 +++ b/tests/test-md5.c Mon Jun 25 01:02:39 2018 +0200 @@ -26,6 +26,8 @@ #include <string.h> #include <unistd.h> +#include "macros.h" + #define TESTFILE "test-md5.data" #include "test-digest.h"
--- a/tests/test-sha1.c Sun Jun 24 15:15:16 2018 -0700 +++ b/tests/test-sha1.c Mon Jun 25 01:02:39 2018 +0200 @@ -24,6 +24,8 @@ #include <string.h> #include <unistd.h> +#include "macros.h" + #define TESTFILE "test-sha1.data" #include "test-digest.h"