File indexing completed on 2025-10-22 07:53:33
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Utilities/HashedString.hpp"
0012
0013 #include <string>
0014 #include <string_view>
0015
0016 using namespace Acts;
0017 using namespace Acts::HashedStringLiteral;
0018
0019 namespace ActsTests {
0020
0021 BOOST_AUTO_TEST_SUITE(UtilitiesSuite)
0022
0023 BOOST_AUTO_TEST_CASE(string_hashes) {
0024
0025 static_assert(hashString("abc") == 440920331, "Invalid with func");
0026 static_assert("abc"_hash == 440920331, "Invalid with literal");
0027 static_assert("abc"_hash == hashString("abc"), "Invalid");
0028
0029
0030 BOOST_CHECK_EQUAL(hashString("abc"), 440920331);
0031 BOOST_CHECK_EQUAL("abc"_hash, 440920331);
0032
0033 std::string s = "abc";
0034 BOOST_CHECK_EQUAL(hashStringDynamic(s), 440920331);
0035 constexpr std::string_view sv{"abc"};
0036 BOOST_CHECK_EQUAL(hashString(sv), 440920331);
0037 static_assert(hashString(sv) == 440920331, "Invalid");
0038 }
0039
0040 BOOST_AUTO_TEST_SUITE_END()
0041
0042 }