feat(string): add SStrHashHT

This commit is contained in:
fallenoak 2020-11-14 17:18:49 -06:00
parent f631bdac3b
commit abb9e8ed79
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
6 changed files with 277 additions and 0 deletions

20
test/String.cpp Normal file
View file

@ -0,0 +1,20 @@
#include "storm/String.hpp"
#include "test/Test.hpp"
TEST_CASE("SStrHashHT", "[string]") {
SECTION("hashes simple string correctly") {
auto hash = SStrHashHT("foo");
REQUIRE(hash == 1371562358u);
}
SECTION("hashes string with forward slash correctly") {
auto hash = SStrHashHT("foo/bar");
REQUIRE(hash == 2270424393u);
}
SECTION("hashes string with forward slash equivalent to back slash") {
auto hashForwardSlash = SStrHashHT("foo/bar");
auto hashBackSlash = SStrHashHT("foo\\bar");
REQUIRE(hashForwardSlash == hashBackSlash);
}
}