diff --git a/include/xrpl/beast/hash/xxhasher.h b/include/xrpl/beast/hash/xxhasher.h index 9cd343f544..5c82d20c6a 100644 --- a/include/xrpl/beast/hash/xxhasher.h +++ b/include/xrpl/beast/hash/xxhasher.h @@ -36,6 +36,7 @@ class xxhasher { public: using result_type = std::size_t; + static int volatile test; private: static_assert(sizeof(std::size_t) == 8, "requires 64-bit std::size_t"); @@ -143,6 +144,7 @@ public: { if (state_) { + test = test + 1; XXH3_freeState(state_); } } diff --git a/src/test/beast/xxhasher_test.cpp b/src/test/beast/xxhasher_test.cpp index 6c65fea601..df5aedbaf3 100644 --- a/src/test/beast/xxhasher_test.cpp +++ b/src/test/beast/xxhasher_test.cpp @@ -22,6 +22,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. namespace beast { +int volatile xxhasher::test = 0; + class XXHasher_test : public unit_test::suite { public: @@ -102,6 +104,8 @@ public: BEAST_EXPECT( static_cast(hasher) == 17285302196561698791ULL); + + BEAST_EXPECT(xxhasher::test > 0); } void @@ -123,6 +127,8 @@ public: BEAST_EXPECT( static_cast(hasher) == 1865045178324729219ULL); + + BEAST_EXPECT(xxhasher::test > 0); } void @@ -144,6 +150,8 @@ public: BEAST_EXPECT( static_cast(hasher) == 16189862915636005281ULL); + + BEAST_EXPECT(xxhasher::test > 0); } void @@ -162,6 +170,8 @@ public: BEAST_EXPECT( static_cast(hasher) == 15296278154063476002ULL); + + BEAST_EXPECT(xxhasher::test > 0); } void @@ -180,6 +190,8 @@ public: BEAST_EXPECT( static_cast(hasher) == 17285302196561698791ULL); + + BEAST_EXPECT(xxhasher::test > 0); } void @@ -210,6 +222,8 @@ public: BEAST_EXPECT(xxhashResult1 == xxhashResult2); } + + BEAST_EXPECT(xxhasher::test > 0); } void