File indexing completed on 2025-01-18 09:12:58
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::HashedStringLiteral;
0017
0018 namespace Acts::Test {
0019
0020 BOOST_AUTO_TEST_CASE(string_hashes) {
0021
0022 static_assert(hashString("abc") == 440920331, "Invalid with func");
0023 static_assert("abc"_hash == 440920331, "Invalid with literal");
0024 static_assert("abc"_hash == hashString("abc"), "Invalid");
0025
0026
0027 BOOST_CHECK_EQUAL(hashString("abc"), 440920331);
0028 BOOST_CHECK_EQUAL("abc"_hash, 440920331);
0029
0030 std::string s = "abc";
0031 BOOST_CHECK_EQUAL(hashStringDynamic(s), 440920331);
0032 constexpr std::string_view sv{"abc"};
0033 BOOST_CHECK_EQUAL(hashString(sv), 440920331);
0034 static_assert(hashString(sv) == 440920331, "Invalid");
0035 }
0036
0037 }