1#include <xrpl/beast/hash/xxhasher.h>
2#include <xrpl/beast/unit_test.h>
17 hasher(objectToHash.data(), objectToHash.size());
21 16042857369214894119ULL);
32 hasher(objectToHash.data(), objectToHash.size());
36 14440132435660934800ULL);
47 hasher(objectToHash.data(), objectToHash.size());
51 14440132435660934800ULL);
57 testcase(
"Big object with multiple small updates without seed");
61 for (
int i = 0; i < 100; i++)
63 hasher(objectToHash.data(), objectToHash.size());
68 15296278154063476002ULL);
74 testcase(
"Big object with multiple small updates with seed");
78 for (
int i = 0; i < 100; i++)
80 hasher(objectToHash.data(), objectToHash.size());
85 17285302196561698791ULL);
91 testcase(
"Big object with small and big updates without seed");
96 for (
int i = 0; i < 20; i++)
98 bigObject +=
"Hello, xxHash!";
100 hasher(objectToHash.data(), objectToHash.size());
101 hasher(bigObject.
data(), bigObject.
size());
102 hasher(objectToHash.data(), objectToHash.size());
106 1865045178324729219ULL);
112 testcase(
"Big object with small and big updates with seed");
117 for (
int i = 0; i < 20; i++)
119 bigObject +=
"Hello, xxHash!";
121 hasher(objectToHash.data(), objectToHash.size());
122 hasher(bigObject.
data(), bigObject.
size());
123 hasher(objectToHash.data(), objectToHash.size());
127 16189862915636005281ULL);
133 testcase(
"Big object with one update without seed");
137 for (
int i = 0; i < 100; i++)
139 objectToHash +=
"Hello, xxHash!";
141 hasher(objectToHash.
data(), objectToHash.
size());
145 15296278154063476002ULL);
151 testcase(
"Big object with one update with seed");
155 for (
int i = 0; i < 100; i++)
157 objectToHash +=
"Hello, xxHash!";
159 hasher(objectToHash.
data(), objectToHash.
size());
163 17285302196561698791ULL);
169 testcase(
"Operator result type doesn't change the internal state");
174 hasher(
object.data(),
object.size());
178 BEAST_EXPECT(xxhashResult1 == xxhashResult2);
184 for (
int i = 0; i < 100; i++)
186 object +=
"Hello, xxHash!";
188 hasher(
object.data(),
object.size());
192 BEAST_EXPECT(xxhashResult1 == xxhashResult2);
212BEAST_DEFINE_TESTSUITE(XXHasher, beast_core,
beast);
void testBigObjectWithSmallAndBigUpdatesWithoutSeed()
void testBigObjectWithOneUpdateWithSeed()
void testBigObjectWithMultiupleSmallUpdatesWithSeed()
void testBigObjectWithOneUpdateWithoutSeed()
void testBigObjectWithSmallAndBigUpdatesWithSeed()
void testOperatorResultTypeDoesNotChangeInternalState()
void testBigObjectWithMultiupleSmallUpdatesWithoutSeed()
void run() override
Runs the suite.
testcase_t testcase
Memberspace for declaring test cases.