diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-env-replace.c | 6 | ||||
-rw-r--r-- | src/test/test-hashmap-plain.c | 2 | ||||
-rw-r--r-- | src/test/test-siphash24.c | 24 |
3 files changed, 14 insertions, 18 deletions
diff --git a/src/test/test-env-replace.c b/src/test/test-env-replace.c index 2e28c0c49b..110223f3b8 100644 --- a/src/test/test-env-replace.c +++ b/src/test/test-env-replace.c @@ -118,6 +118,8 @@ static void test_replace_env_arg(void) { "$FOO$FOO", "${FOO}${BAR}", "${FOO", + "FOO$$${FOO}", + "$$FOO${FOO}", NULL }; _cleanup_strv_free_ char **r = NULL; @@ -133,7 +135,9 @@ static void test_replace_env_arg(void) { assert_se(streq(r[6], "BAR")); assert_se(streq(r[7], "BAR BARwaldo")); assert_se(streq(r[8], "${FOO")); - assert_se(strv_length(r) == 9); + assert_se(streq(r[9], "FOO$BAR BAR")); + assert_se(streq(r[10], "$FOOBAR BAR")); + assert_se(strv_length(r) == 11); } static void test_env_clean(void) { diff --git a/src/test/test-hashmap-plain.c b/src/test/test-hashmap-plain.c index 78f9c19f5b..c691f577c6 100644 --- a/src/test/test-hashmap-plain.c +++ b/src/test/test-hashmap-plain.c @@ -710,7 +710,7 @@ static void test_hashmap_many(void) { unsigned n_entries; } tests[] = { { .ops = NULL, .n_entries = 1 << 20 }, - { .ops = &crippled_hashmap_ops, .n_entries = 1 << 11 }, + { .ops = &crippled_hashmap_ops, .n_entries = 1 << 14 }, }; diff --git a/src/test/test-siphash24.c b/src/test/test-siphash24.c index 65eb2b6f35..2402da6a6f 100644 --- a/src/test/test-siphash24.c +++ b/src/test/test-siphash24.c @@ -32,23 +32,13 @@ int main(int argc, char *argv[]) { const uint8_t key[16] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}; uint64_t out = 0; - unsigned i, j, k; - usec_t ts; + unsigned i, j; siphash24((uint8_t *)&out, in, sizeof(in), key); - assert_se(out == 0xa129ca6149be45e5); - - assert_se(out == 0xa129ca6149be45e5ULL); - - ts = now(CLOCK_MONOTONIC); - for (k = 0; k < ITERATIONS; k++) - siphash24((uint8_t *)&out, in, sizeof(in), key); - ts = now(CLOCK_MONOTONIC) - ts; - - log_info("%llu iterations per second", (ITERATIONS * USEC_PER_SEC) / ts); + assert_se(out == htole64(0xa129ca6149be45e5)); /* verify the internal state as given in the above paper */ - siphash_init(&state, key); + siphash24_init(&state, key); assert_se(state.v0 == 0x7469686173716475); assert_se(state.v1 == 0x6b617f6d656e6665); assert_se(state.v2 == 0x6b7f62616d677361); @@ -58,7 +48,8 @@ int main(int argc, char *argv[]) { assert_se(state.v1 == 0x0d52f6f62a4f59a4); assert_se(state.v2 == 0x634cb3577b01fd3d); assert_se(state.v3 == 0xa5224d6f55c7d9c8); - assert_se(siphash24_finalize(&state) == 0xa129ca6149be45e5); + siphash24_finalize((uint8_t*)&out, &state); + assert_se(out == htole64(0xa129ca6149be45e5)); assert_se(state.v0 == 0xf6bcd53893fecff1); assert_se(state.v1 == 0x54b9964c7ea0d937); assert_se(state.v2 == 0x1b38329c099bb55a); @@ -68,11 +59,12 @@ int main(int argc, char *argv[]) { same result */ for (i = 0; i < sizeof(in); i++) { for (j = i; j < sizeof(in); j++) { - siphash_init(&state, key); + siphash24_init(&state, key); siphash24_compress(in, i, &state); siphash24_compress(&in[i], j - i, &state); siphash24_compress(&in[j], sizeof(in) - j, &state); - assert_se(siphash24_finalize(&state) == 0xa129ca6149be45e5); + siphash24_finalize((uint8_t*)&out, &state); + assert_se(out == htole64(0xa129ca6149be45e5)); } } } |