From 4041d06e95092af776ebddb8b9b3b5eefd798063 Mon Sep 17 00:00:00 2001 From: LeonineKing1199 Date: Mon, 6 Dec 2021 15:04:40 -0800 Subject: [PATCH] Clean up tests --- test/unordered/transparent_tests.cpp | 46 +++++++++++++++------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/test/unordered/transparent_tests.cpp b/test/unordered/transparent_tests.cpp index 18cd7200..50ec0ee3 100644 --- a/test/unordered/transparent_tests.cpp +++ b/test/unordered/transparent_tests.cpp @@ -620,8 +620,9 @@ template void test_non_transparent_erase() BOOST_TEST_EQ(key::count_, key_count); } -// test that in the presence of the member function template `extract()`, we still -// invoke the correct iterator overloads when the type is implicitly convertible +// test that in the presence of the member function template `extract()`, we +// still invoke the correct iterator overloads when the type is implicitly +// convertible // transparent_unordered_map::node_type extract_overload_compile_test() { @@ -643,20 +644,20 @@ template void test_transparent_extract() node_type nh = map.extract(0); BOOST_TEST(nh.empty()); - BOOST_TEST(key::count_ == 0); + BOOST_TEST_EQ(key::count_, 0); map[key(0)] = 1337; map[key(1)] = 1338; map[key(2)] = 1339; - BOOST_TEST(map.size() == 3); + BOOST_TEST_EQ(map.size(), 3); int const expected_key_count = static_cast(2 * map.size()); - BOOST_TEST(key::count_ == expected_key_count); + BOOST_TEST_EQ(key::count_, expected_key_count); nh = map.extract(1); - BOOST_TEST(map.size() == 2); - BOOST_TEST(nh.key().x_ == 1); - BOOST_TEST(nh.mapped() == 1338); + BOOST_TEST_EQ(map.size(), 2); + BOOST_TEST_EQ(nh.key().x_, 1); + BOOST_TEST_EQ(nh.mapped(), 1338); nh.mapped() = 1340; @@ -666,12 +667,12 @@ template void test_transparent_extract() const_iterator pos = map.find(1); BOOST_TEST(pos != map.end()); - BOOST_TEST(pos->second == 1340); + BOOST_TEST_EQ(pos->second, 1340); nh = map.extract(1337); BOOST_TEST(nh.empty()); - BOOST_TEST(key::count_ == expected_key_count); + BOOST_TEST_EQ(key::count_, expected_key_count); } template void test_non_transparent_extract() @@ -685,36 +686,39 @@ template void test_non_transparent_extract() node_type nh = map.extract(0); BOOST_TEST(nh.empty()); - BOOST_TEST(key::count_ == 1); + BOOST_TEST_EQ(key::count_, 1); map[key(0)] = 1337; map[key(1)] = 1338; map[key(2)] = 1339; - BOOST_TEST(map.size() == 3); + BOOST_TEST_EQ(map.size(), 3); int key_count = 1 + static_cast(2 * map.size()); - BOOST_TEST(key::count_ == key_count); + BOOST_TEST_EQ(key::count_, key_count); nh = map.extract(1); - BOOST_TEST(map.size() == 2); - BOOST_TEST(nh.key().x_ == 1); - BOOST_TEST(nh.mapped() == 1338); - BOOST_TEST(key::count_ == ++key_count); + ++key_count; + BOOST_TEST_EQ(map.size(), 2); + BOOST_TEST_EQ(nh.key().x_, 1); + BOOST_TEST_EQ(nh.mapped(), 1338); + BOOST_TEST_EQ(key::count_, key_count); nh.mapped() = 1340; map.insert(boost::move(nh)); - BOOST_TEST(map.size() == 3); + BOOST_TEST_EQ(map.size(), 3); const_iterator pos = map.find(1); + ++key_count; BOOST_TEST(pos != map.end()); - BOOST_TEST(pos->second == 1340); - BOOST_TEST(key::count_ == ++key_count); + BOOST_TEST_EQ(pos->second, 1340); + BOOST_TEST_EQ(key::count_, key_count); nh = map.extract(1337); + ++key_count; BOOST_TEST(nh.empty()); - BOOST_TEST(key::count_ == ++key_count); + BOOST_TEST_EQ(key::count_, key_count); } UNORDERED_AUTO_TEST (unordered_map_transparent_count) {