summaryrefslogtreecommitdiff
path: root/tests/crc32.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-18 16:09:31 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-18 22:53:32 +0200
commit50385e06ec207af0171c021f1909e9ef38c00519 (patch)
tree690bfe53cef9f901c68f76f4fe50c1917e368fe2 /tests/crc32.c
parent58c5d7c933a714096ef0dd42bd1446a6e1a25a16 (diff)
Replace update_crc32 helper function with crc32 from zlib
It is optimized to the maximum and if we already use zlib anyway, why not use zlib crc32? This also makes zlib a hard dependency which also means the whole "do we have a compressor" sanity check in the build system can be removed. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/crc32.c')
-rw-r--r--tests/crc32.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/tests/crc32.c b/tests/crc32.c
deleted file mode 100644
index 669c6a4..0000000
--- a/tests/crc32.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
-/*
- * crc32.c
- *
- * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
- */
-#include "config.h"
-#include "util.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-static const struct {
- const char *str;
- uint32_t result;
-} test_vectors[] = {
- { "", 0 },
- { "Hello, World!", 0xEC4AC3D0 },
- { "The quick brown fox jumps over the lazy dog", 0x414FA339 },
-};
-
-int main(void)
-{
- uint32_t crc;
- size_t i;
-
- for (i = 0; i < sizeof(test_vectors) / sizeof(test_vectors[0]); ++i) {
- crc = update_crc32(0, test_vectors[i].str,
- strlen(test_vectors[i].str));
-
- if (crc != test_vectors[i].result) {
- fprintf(stderr, "Case %zu failed: %08X != %08X\n", i,
- crc, test_vectors[i].result);
- return EXIT_FAILURE;
- }
- }
-
- return EXIT_SUCCESS;
-}