aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/xxhash.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2024-12-13 12:11:16 +0100
committerStefan Boberg <[email protected]>2024-12-13 12:11:16 +0100
commite4a7e9b30023c1c5195de9e78f02c075ff176460 (patch)
treeaaffd1e1954fba67f34969d2c2ead64d19d9d75f /src/zencore/xxhash.cpp
parentadded ComputeOpKey so all instances of mapping key -> Oid is in a single place (diff)
downloadzen-e4a7e9b30023c1c5195de9e78f02c075ff176460.tar.xz
zen-e4a7e9b30023c1c5195de9e78f02c075ff176460.zip
fixed XXH3_128Stream so it initializes the state properly
the old version is still present for now, with a _deprecated suffix
Diffstat (limited to 'src/zencore/xxhash.cpp')
-rw-r--r--src/zencore/xxhash.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/zencore/xxhash.cpp b/src/zencore/xxhash.cpp
index ff88a4372..80d7bc8fd 100644
--- a/src/zencore/xxhash.cpp
+++ b/src/zencore/xxhash.cpp
@@ -69,12 +69,20 @@ TEST_CASE("XXH3_128")
"1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"};
+ SUBCASE("short_deprecated")
+ {
+ XXH3_128Stream_deprecated x;
+ x.Append(ShortString.data(), ShortString.size());
+ const XXH3_128 Hash = x.GetHash();
+ CHECK(Hash == XXH3_128::FromHexString("0d44dd7fde8ea2b4ba961e1a26f71f21"sv));
+ }
+
SUBCASE("short")
{
XXH3_128Stream x;
x.Append(ShortString.data(), ShortString.size());
const XXH3_128 Hash = x.GetHash();
- CHECK(Hash == XXH3_128::FromHexString("0d44dd7fde8ea2b4ba961e1a26f71f21"sv));
+ CHECK(Hash == XXH3_128::FromHexString("9a4dea864648af82823c8c03e6dd2202"sv));
}
SUBCASE("long")
@@ -82,7 +90,7 @@ TEST_CASE("XXH3_128")
XXH3_128Stream x;
x.Append(LongString.data(), LongString.size());
const XXH3_128 Hash = x.GetHash();
- CHECK(Hash == XXH3_128::FromHexString("bc408748826fb22da051517c97c9d181"sv));
+ CHECK(Hash == XXH3_128::FromHexString("fbd5e72f7a5894590d1ef49dfcc58b7d"sv));
}
}