aboutsummaryrefslogtreecommitdiffstats
path: root/t/sha1.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-09-01 18:12:21 +0200
committerMattias Andrée <maandree@kth.se>2024-09-01 18:12:21 +0200
commit85b12e691577b4d4fe09b80b06e91a801dc3dfa9 (patch)
tree69c64bc9a9fc97826fe8cb2d7ef82f00b1193efc /t/sha1.c
parentAdd support for BLAKE2 (but not tree-hashing) (diff)
downloadlibhashsum-85b12e691577b4d4fe09b80b06e91a801dc3dfa9.tar.gz
libhashsum-85b12e691577b4d4fe09b80b06e91a801dc3dfa9.tar.bz2
libhashsum-85b12e691577b4d4fe09b80b06e91a801dc3dfa9.tar.xz
Move test files into t/
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 't/sha1.c')
-rw-r--r--t/sha1.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/t/sha1.c b/t/sha1.c
new file mode 100644
index 0000000..7523dd6
--- /dev/null
+++ b/t/sha1.c
@@ -0,0 +1,50 @@
+/* See LICENSE file for copyright and license details. */
+#ifdef SUPPORT_SHA1
+# define TEST
+# include "../common.h"
+
+
+static struct testcase testcases[] = {
+ {1, 0, "", "da39a3ee5e6b4b0d3255bfef95601890afd80709"},
+ {1, 0, "\xff", "85e53271e14006f0265921d02d4d736cdc580b0b"},
+ {1, 0, "\xe5\xe0\x99\x24", "d1dffbc8a175dd8eebe0da87b1792b6dc1018e82"},
+ {56UL, 8, "\0", "9438e360f578e12c0e0e8ed28e2c125c1cefee16"},
+ {1000UL, 0, "Q", "49f1cfe3829963158e2b2b2cb5df086cee2e3bb0"},
+ {1000UL, 0, "A", "3ae3644d6777a1f56a1defeabc74af9c4b313e49"},
+ {1005UL, 0, "\x99", "18685d56c8bf67c3cee4443e9a78f65c30752f5d"},
+ {1, 0, "abc", "a9993e364706816aba3e25717850c26c9cd0d89d"},
+ {1, 0, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
+ "84983e441c3bd26ebaae4aa1f95129e5e54670f1"},
+# ifdef MASSIVE_TESTS
+ {0x20000000UL, 0, "A", "df3f26fce8fa7bec2c61d0506749a320ac7dc942"},
+ {0x41000000UL, 8, "\0", "320c617b0b6ee1b6f9c3271eae135f40cae22c10"},
+ {0x6000003FUL, 0, "\x84", "b20aa99b62e6a480fd93b4d24b2c19ffac649bb8"},
+# endif
+ {1000000UL, 8, "\0", "bef3595266a65a2ff36b700a75e8ed95c68210b6"},
+ {0, 1, "\x00", "bb6b3e18f0115b57925241676f5b1ae88747b08a"},
+ {0, 2, "\x01", "ec6b39952e1a3ec3ab3507185cf756181c84bbe2"},
+ {0, 3, "\x04", "a37596ec13a0d2f9e6c0b8b96f9112823aa6d961"},
+ {0, 4, "\x0d", "ba582f5967911beb91599684c2eb2baeefb78da7"},
+ {0, 5, "\x09", "3320540d1c28b96ddd03eee1b186a8f2ae883fbe"},
+ {0, 6, "\x08", "b372bd120957ebc3392cd060e131699d1fee6059"},
+ {0, 7, "\x22", "04f31807151181ad0db278a1660526b0aeef64c2"},
+ {0, 1, "\xff", "59c4526aa2cc59f9a5f56b5579ba7108e7ccb61a"},
+ {0, 1, "\x7f", "59c4526aa2cc59f9a5f56b5579ba7108e7ccb61a"},
+ {0, 1, "\x01", "59c4526aa2cc59f9a5f56b5579ba7108e7ccb61a"},
+ {0, 1, "\xfe", "bb6b3e18f0115b57925241676f5b1ae88747b08a"},
+ {0, 1, "\x7e", "bb6b3e18f0115b57925241676f5b1ae88747b08a"},
+ {0, 1, "\x00", "bb6b3e18f0115b57925241676f5b1ae88747b08a"}
+};
+
+
+#else
+# define TEST_UNSUPPORTED
+# include "../common.h"
+#endif
+
+
+int
+main(void)
+{
+ TEST_MAIN("SHA1", SHA1);
+}