20#include <xrpl/beast/hash/xxhasher.h>
21#include <xrpl/beast/unit_test.h>
36 hasher(objectToHash.data(), objectToHash.size());
40 16042857369214894119ULL);
51 hasher(objectToHash.data(), objectToHash.size());
55 14440132435660934800ULL);
66 hasher(objectToHash.data(), objectToHash.size());
70 14440132435660934800ULL);
76 testcase(
"Big object with multiple small updates without seed");
80 for (
int i = 0; i < 100; i++)
82 hasher(objectToHash.data(), objectToHash.size());
87 15296278154063476002ULL);
93 testcase(
"Big object with multiple small updates with seed");
97 for (
int i = 0; i < 100; i++)
99 hasher(objectToHash.data(), objectToHash.size());
104 17285302196561698791ULL);
110 testcase(
"Big object with small and big updates without seed");
115 for (
int i = 0; i < 20; i++)
117 bigObject +=
"Hello, xxHash!";
119 hasher(objectToHash.data(), objectToHash.size());
120 hasher(bigObject.
data(), bigObject.
size());
121 hasher(objectToHash.data(), objectToHash.size());
125 1865045178324729219ULL);
131 testcase(
"Big object with small and big updates with seed");
136 for (
int i = 0; i < 20; i++)
138 bigObject +=
"Hello, xxHash!";
140 hasher(objectToHash.data(), objectToHash.size());
141 hasher(bigObject.
data(), bigObject.
size());
142 hasher(objectToHash.data(), objectToHash.size());
146 16189862915636005281ULL);
152 testcase(
"Big object with one update without seed");
156 for (
int i = 0; i < 100; i++)
158 objectToHash +=
"Hello, xxHash!";
160 hasher(objectToHash.
data(), objectToHash.
size());
164 15296278154063476002ULL);
170 testcase(
"Big object with one update with seed");
174 for (
int i = 0; i < 100; i++)
176 objectToHash +=
"Hello, xxHash!";
178 hasher(objectToHash.
data(), objectToHash.
size());
182 17285302196561698791ULL);
188 testcase(
"Operator result type doesn't change the internal state");
193 hasher(
object.data(),
object.size());
197 BEAST_EXPECT(xxhashResult1 == xxhashResult2);
203 for (
int i = 0; i < 100; i++)
205 object +=
"Hello, xxHash!";
207 hasher(
object.data(),
object.size());
211 BEAST_EXPECT(xxhashResult1 == xxhashResult2);
231BEAST_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.