File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -349,6 +349,30 @@ TEST_CASE(clear_with_capacity_when_empty)
349349 VERIFY (map.size () == 2 );
350350}
351351
352+ struct NonTrivial {
353+ ~NonTrivial () { }
354+ bool operator ==(NonTrivial const &) const { return true ; }
355+ };
356+
357+ namespace AK {
358+
359+ template <>
360+ struct Traits <NonTrivial> : public DefaultTraits<NonTrivial> {
361+ static unsigned hash (NonTrivial const &) { return 0 ; }
362+ };
363+
364+ }
365+
366+ TEST_CASE (clear_with_capacity_with_non_trivial_type)
367+ {
368+ static_assert (!IsTriviallyDestructible<NonTrivial>);
369+
370+ HashTable<NonTrivial> map;
371+ map.set ({});
372+ map.clear_with_capacity ();
373+ VERIFY (map.size () == 0 );
374+ }
375+
352376TEST_CASE (iterator_removal)
353377{
354378 HashTable<int > map;
You can’t perform that action at this time.
0 commit comments