Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions third_party/blink/renderer/platform/wtf/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ visibility = [
]

config("wtf_config") {
cflags = ["-g", "-O0"]
if (is_win) {
cflags = [
# Don't complain about calling specific versions of templatized
Expand Down Expand Up @@ -340,6 +341,7 @@ source_set("wtf_unittests_sources") {
"vector_test.cc",
]

cflags = ["-g", "-O0"]
if (is_win) {
cflags = [ "/wd4068" ] # Unknown pragma.
}
Expand Down
20 changes: 20 additions & 0 deletions third_party/blink/renderer/platform/wtf/hash_map_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,26 @@ TEST(HashMapTest, Iteration) {
EXPECT_EQ((1 << 10) - 1, encountered_keys);
}

TEST(HashMapTest, OrderedIteration) {
IntHashMap map;
for (int i = 0; i < 10; ++i)
map.insert(1 << i, i);

int i = 0;
for (auto it = map.begin(); it != map.end(); ++it) {
EXPECT_EQ(it->key, 1<<i);
EXPECT_EQ(it->value, i);
i++;
}
i = 10;
for (auto it = map.end(); it != map.begin();) {
--it;
--i;
EXPECT_EQ(it->key, 1<<i);
EXPECT_EQ(it->value, i);
}
}

struct TestDoubleHashTraits : HashTraits<double> {
static const unsigned kMinimumTableSize = 8;
};
Expand Down
Loading