mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 18:37:58 +03:00
516d736afe
Get rid of the ConstIterator classes for these containers and use templated FooIterator<T, ...> and FooIterator<const T, ...> helpers. This makes the HashTable class a lot easier to read.
29 lines
635 B
C++
29 lines
635 B
C++
#include "TestHelpers.h"
|
|
#include <AK/AKString.h>
|
|
#include <AK/HashMap.h>
|
|
|
|
typedef HashMap<int, int> IntIntMap;
|
|
|
|
int main()
|
|
{
|
|
EXPECT(IntIntMap().is_empty());
|
|
EXPECT(IntIntMap().size() == 0);
|
|
|
|
HashMap<int, String> number_to_string;
|
|
number_to_string.set(1, "One");
|
|
number_to_string.set(2, "Two");
|
|
number_to_string.set(3, "Three");
|
|
|
|
EXPECT_EQ(number_to_string.is_empty(), false);
|
|
EXPECT_EQ(number_to_string.size(), 3);
|
|
|
|
int loop_counter = 0;
|
|
for (auto& it : number_to_string) {
|
|
EXPECT(!it.value.is_null());
|
|
++loop_counter;
|
|
}
|
|
|
|
EXPECT_EQ(loop_counter, 3);
|
|
return 0;
|
|
}
|