[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
af_alg tests: Add another test
From: |
Bruno Haible |
Subject: |
af_alg tests: Add another test |
Date: |
Mon, 25 Jun 2018 01:03:56 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-128-generic; KDE/5.18.0; x86_64; ; ) |
2018-06-24 Bruno Haible <address@hidden>
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.
diff --git a/tests/test-digest.h b/tests/test-digest.h
index e10f571..369ef9f 100644
--- a/tests/test-digest.h
+++ b/tests/test-digest.h
@@ -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))
diff --git a/tests/test-md5.c b/tests/test-md5.c
index 7109343..9e27be3 100644
--- a/tests/test-md5.c
+++ b/tests/test-md5.c
@@ -26,6 +26,8 @@
#include <string.h>
#include <unistd.h>
+#include "macros.h"
+
#define TESTFILE "test-md5.data"
#include "test-digest.h"
diff --git a/tests/test-sha1.c b/tests/test-sha1.c
index 9b6cde3..dc056ae 100644
--- a/tests/test-sha1.c
+++ b/tests/test-sha1.c
@@ -24,6 +24,8 @@
#include <string.h>
#include <unistd.h>
+#include "macros.h"
+
#define TESTFILE "test-sha1.data"
#include "test-digest.h"
diff --git a/tests/test-sha256.c b/tests/test-sha256.c
index 0a2667a..bc820ad 100644
--- a/tests/test-sha256.c
+++ b/tests/test-sha256.c
@@ -23,6 +23,8 @@
#include <string.h>
#include <unistd.h>
+#include "macros.h"
+
#define TESTFILE "test-sha256.data"
#include "test-digest.h"
diff --git a/tests/test-sha512.c b/tests/test-sha512.c
index 577feb1..72ff90c 100644
--- a/tests/test-sha512.c
+++ b/tests/test-sha512.c
@@ -23,6 +23,8 @@
#include <string.h>
#include <unistd.h>
+#include "macros.h"
+
#define TESTFILE "test-sha512.data"
#include "test-digest.h"
diff --git a/modules/crypto/md5-tests b/modules/crypto/md5-tests
index 6e9c162..177bd41 100644
--- a/modules/crypto/md5-tests
+++ b/modules/crypto/md5-tests
@@ -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
diff --git a/modules/crypto/sha1-tests b/modules/crypto/sha1-tests
index c0f68cf..b30d7e5 100644
--- a/modules/crypto/sha1-tests
+++ b/modules/crypto/sha1-tests
@@ -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
diff --git a/modules/crypto/sha256-tests b/modules/crypto/sha256-tests
index eecbee8..693b1bc 100644
--- a/modules/crypto/sha256-tests
+++ b/modules/crypto/sha256-tests
@@ -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
diff --git a/modules/crypto/sha512-tests b/modules/crypto/sha512-tests
index 18f5f1c..d448031 100644
--- a/modules/crypto/sha512-tests
+++ b/modules/crypto/sha512-tests
@@ -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
- af_alg tests: Add another test,
Bruno Haible <=