summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNathan Moinvaziri <nathan@nathanm.com>2026-01-12 11:18:56 -0800
committerHans Kristian Rosbach <hk-github@circlestorm.org>2026-01-13 18:43:50 +0100
commitd684da4ff54502d91331548c8fda18aab3680ed6 (patch)
treea5c183f68f5b87d56bd9a297db5931127df3560a /test
parenta17bae48614ea02f6a2abdacd3f293a5f0740338 (diff)
downloadProject-Tick-d684da4ff54502d91331548c8fda18aab3680ed6.tar.gz
Project-Tick-d684da4ff54502d91331548c8fda18aab3680ed6.zip
Clean up buf == NULL handling on adler32 functions and test strings.
Diffstat (limited to 'test')
-rw-r--r--test/hash_test_strings_p.h9
-rw-r--r--test/test_adler32_copy.cc4
-rw-r--r--test/test_crc32.cc15
-rw-r--r--test/test_crc32_copy.cc4
4 files changed, 2 insertions, 30 deletions
diff --git a/test/hash_test_strings_p.h b/test/hash_test_strings_p.h
index 39079395a7..447d1a6449 100644
--- a/test/hash_test_strings_p.h
+++ b/test/hash_test_strings_p.h
@@ -202,14 +202,6 @@ typedef struct {
} hash_test;
static const hash_test hash_tests[] = {
- {0, (const uint8_t *)0x0, 0x0, 0x1, 0x0, 0x0},
- {0, (const uint8_t *)0x0, 0xffffffff, 0x1, 0xffffffff, 0x0},
- {255, (const uint8_t *)0x0, 0x0, 0x1, 0x0, 0x0}, /* BZ 174799. */
- {256, (const uint8_t *)0x0, 0x0, 0x1, 0x0, 0x0},
- {257, (const uint8_t *)0x0, 0x0, 0x1, 0x0, 0x0},
- {32767, (const uint8_t *)0x0, 0x0, 0x1, 0x0, 0x0},
- {32768, (const uint8_t *)0x0, 0x0, 0x1, 0x0, 0x0},
- {32769, (const uint8_t *)0x0, 0x0, 0x1, 0x0, 0x0},
{0, (const uint8_t *)"", 0x1, 0x1, 0x0, 0x0},
{1, (const uint8_t *)"", 0x1, 0x10001, 0x0, 0xd202ef8d},
{0, (const uint8_t *)"", 0xffffffff, 0x000e000e, 0xffffffff, 0xffffffff},
@@ -285,7 +277,6 @@ static const hash_test hash_tests[] = {
{100, (const uint8_t *)"r*Fd}ef+5RJQ;+W=4jTR9)R*p!B;]Ed7tkrLi;88U7g@3v!5pk2X6D)vt,.@N8c]@yyEcKi[vwUu@.Ppm@C6%Mv*3Nw}Y,58_aH)", 0x1, 0xfbdb1e96, 0x0, 0xeaa52777},
{100, (const uint8_t *)"h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&", 0x1, 0x47a61ec8, 0x0, 0xcd472048},
{5552, (const uint8_t *)long_string, 0x1, 0x8b81718f, 0x0, 0x426fa73b},
- {0, (const uint8_t *)0x0, 0x7a30360d, 0x1, 0x0, 0x0},
{6, (const uint8_t *)"abacus", 0x1, 0x8400270, 0x7a30360d, 0xf8655a84},
{1, (const uint8_t *)"", 0x6fd767ee, 0xd7c567ee, 0x6fd767ee, 0x95dff795},
{1, (const uint8_t *)"a", 0xefeb7589, 0x65e475ea, 0x0, 0xe8b7be43},
diff --git a/test/test_adler32_copy.cc b/test/test_adler32_copy.cc
index 61ec8986ac..725d86aa95 100644
--- a/test/test_adler32_copy.cc
+++ b/test/test_adler32_copy.cc
@@ -21,10 +21,6 @@ public:
void adler32_copy_test(adler32_copy_func copyfunc, hash_test params) {
ASSERT_LE(params.len, HASH_TEST_MAX_LENGTH);
- if (params.buf == NULL) {
- GTEST_SKIP();
- }
-
uint32_t adler = copyfunc(params.initial_adler, dstbuf, params.buf, params.len);
EXPECT_EQ(adler, params.expect_adler);
diff --git a/test/test_crc32.cc b/test/test_crc32.cc
index 945a2176b2..73752fe762 100644
--- a/test/test_crc32.cc
+++ b/test/test_crc32.cc
@@ -18,14 +18,7 @@ extern "C" {
class crc32_variant : public ::testing::TestWithParam<hash_test> {
public:
void hash(hash_test param, crc32_func crc32) {
- uint32_t crc = 0;
- if (param.buf != NULL) {
- if (param.len) {
- crc = crc32(param.initial_crc, param.buf, param.len);
- } else {
- crc = param.initial_crc;
- }
- }
+ uint32_t crc = crc32(param.initial_crc, param.buf, param.len);
EXPECT_EQ(crc, param.expect_crc);
}
};
@@ -37,11 +30,7 @@ class crc32_align : public ::testing::TestWithParam<int> {
public:
void hash(int param, crc32_func crc32) {
uint8_t *buf = (uint8_t*)zng_alloc(sizeof(uint8_t) * (128 + param));
- if (buf != NULL) {
- (void)crc32(0, buf + param, 128);
- } else {
- FAIL();
- }
+ (void)crc32(0, buf + param, 128);
zng_free(buf);
}
};
diff --git a/test/test_crc32_copy.cc b/test/test_crc32_copy.cc
index 2fc9792b7c..b72884325a 100644
--- a/test/test_crc32_copy.cc
+++ b/test/test_crc32_copy.cc
@@ -21,10 +21,6 @@ public:
void crc32_copy_test(crc32_copy_func copyfunc, hash_test params) {
ASSERT_LE(params.len, HASH_TEST_MAX_LENGTH);
- if (params.buf == NULL) {
- GTEST_SKIP();
- }
-
uint32_t crc = copyfunc(params.initial_crc, dstbuf, params.buf, params.len);
EXPECT_EQ(crc, params.expect_crc);