mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
Tests: Add a test for HashTable<NonTrivial>::clear_with_capacity()
This commit is contained in:
parent
744568c912
commit
84241ea761
|
|
@ -349,6 +349,30 @@ TEST_CASE(clear_with_capacity_when_empty)
|
|||
VERIFY(map.size() == 2);
|
||||
}
|
||||
|
||||
struct NonTrivial {
|
||||
~NonTrivial() { }
|
||||
bool operator==(NonTrivial const&) const { return true; }
|
||||
};
|
||||
|
||||
namespace AK {
|
||||
|
||||
template<>
|
||||
struct Traits<NonTrivial> : public DefaultTraits<NonTrivial> {
|
||||
static unsigned hash(NonTrivial const&) { return 0; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE(clear_with_capacity_with_non_trivial_type)
|
||||
{
|
||||
static_assert(!IsTriviallyDestructible<NonTrivial>);
|
||||
|
||||
HashTable<NonTrivial> map;
|
||||
map.set({});
|
||||
map.clear_with_capacity();
|
||||
VERIFY(map.size() == 0);
|
||||
}
|
||||
|
||||
TEST_CASE(iterator_removal)
|
||||
{
|
||||
HashTable<int> map;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user