mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:27:34 +00:00
AK+Tests: Make CaseInsensitiveStringViewTraits work with HashMap again
This commit is contained in:
parent
822e32eb11
commit
79b9dd6248
2 changed files with 9 additions and 0 deletions
|
@ -348,6 +348,7 @@ struct CaseInsensitiveStringViewTraits : public Traits<StringView> {
|
||||||
return 0;
|
return 0;
|
||||||
return case_insensitive_string_hash(s.characters_without_null_termination(), s.length());
|
return case_insensitive_string_hash(s.characters_without_null_termination(), s.length());
|
||||||
}
|
}
|
||||||
|
static bool equals(StringView const& a, StringView const& b) { return a.equals_ignoring_case(b); }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,14 @@ TEST_CASE(case_insensitive)
|
||||||
EXPECT_EQ(casemap.size(), 1u);
|
EXPECT_EQ(casemap.size(), 1u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE(case_insensitive_stringview)
|
||||||
|
{
|
||||||
|
HashMap<StringView, int, CaseInsensitiveStringViewTraits> casemap;
|
||||||
|
EXPECT_EQ(casemap.set("nickserv"sv, 3), AK::HashSetResult::InsertedNewEntry);
|
||||||
|
EXPECT_EQ(casemap.set("NickServ"sv, 3), AK::HashSetResult::ReplacedExistingEntry);
|
||||||
|
EXPECT_EQ(casemap.size(), 1u);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE(hashmap_of_nonnullownptr_get)
|
TEST_CASE(hashmap_of_nonnullownptr_get)
|
||||||
{
|
{
|
||||||
struct Object {
|
struct Object {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue