]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
af_alg tests: Add another test.
authorBruno Haible <bruno@clisp.org>
Sun, 24 Jun 2018 23:02:39 +0000 (01:02 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 24 Jun 2018 23:07:04 +0000 (01:07 +0200)
* 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.

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

index 2c1d3310b7fb2e70722fd2b5d3733cf6cd975b84..9db47aa0a4ef513b4e06cdec8ef51146380f9565 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 6e9c16214576ee67a910a52f242a1ecaee1aeb39..177bd41231df73d943c1a05ff920c945bab66d36 100644 (file)
@@ -3,6 +3,7 @@ tests/test-md5.c
 tests/test-digest.h
 tests/bench-md5.c
 tests/bench-digest.h
+tests/macros.h
 
 Depends-on:
 getrusage
index c0f68cfb9d2a374013cc0fce398243b913cb21eb..b30d7e55f3e30d5b4740b1f05ee37773fb2d85b0 100644 (file)
@@ -3,6 +3,7 @@ tests/test-sha1.c
 tests/test-digest.h
 tests/bench-sha1.c
 tests/bench-digest.h
+tests/macros.h
 
 Depends-on:
 getrusage
index eecbee86d77e6da76dfc130d17339482ca98e589..693b1bc0ff7da85f7700980f3f7d2fe0eec43668 100644 (file)
@@ -4,6 +4,7 @@ tests/test-digest.h
 tests/bench-sha224.c
 tests/bench-sha256.c
 tests/bench-digest.h
+tests/macros.h
 
 Depends-on:
 getrusage
index 18f5f1c1a3762a12f35b0727532744b372163577..d448031c4f5aa98e800c43dab9c8286e4d6fe2d1 100644 (file)
@@ -4,6 +4,7 @@ tests/test-digest.h
 tests/bench-sha384.c
 tests/bench-sha512.c
 tests/bench-digest.h
+tests/macros.h
 
 Depends-on:
 getrusage
index e10f571fa540b4f102f62d5568ea20943c409d39..369ef9f6a85c669536e89674c919475508e9ddb0 100644 (file)
@@ -25,7 +25,7 @@ test_digest_on_files (int (*streamfunc) (FILE *, void *),
   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 @@ test_digest_on_files (int (*streamfunc) (FILE *, void *),
           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 @@ test_digest_on_files (int (*streamfunc) (FILE *, void *),
           {
           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 @@ test_digest_on_files (int (*streamfunc) (FILE *, void *),
         switch (pass)
           {
           case 2:
+          case 4:
             {
               char header[4];
               if (fread (header, 1, sizeof (header), fp) != sizeof (header))
index 71093436c131200bd3846e786c610d771d0dabda..9e27be35bd8344c21c5eaea4200bba3634a718f6 100644 (file)
@@ -26,6 +26,8 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "macros.h"
+
 #define TESTFILE "test-md5.data"
 #include "test-digest.h"
 
index 9b6cde32b41548f90fa8ca48e791b9b55523ef60..dc056ae92ff4b9dc6f3b3a9cdd41130bced451fc 100644 (file)
@@ -24,6 +24,8 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "macros.h"
+
 #define TESTFILE "test-sha1.data"
 #include "test-digest.h"
 
index 0a2667ae41267a14e4c724c5733ea413c54d55f4..bc820ada3e6d5d0835d5c9c031d1893325cf9b36 100644 (file)
@@ -23,6 +23,8 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "macros.h"
+
 #define TESTFILE "test-sha256.data"
 #include "test-digest.h"
 
index 577feb172d8fcc2792ad2cc7e3d58a413932eba7..72ff90c9f3c9d3fac3cb419a3c552a2e22f4a3d8 100644 (file)
@@ -23,6 +23,8 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "macros.h"
+
 #define TESTFILE "test-sha512.data"
 #include "test-digest.h"