diff --git a/test/unit/small_map.cpp b/test/unit/small_map.cpp index 7f6f003..3657685 100644 --- a/test/unit/small_map.cpp +++ b/test/unit/small_map.cpp @@ -342,6 +342,7 @@ TEST_CASE("Small Map") { { 3, 3 }, { 4, 4 } })); + REQUIRE(a.count(4) == 1); // NOLINTNEXTLINE(performance-move-const-arg) auto p = std::make_pair(5, 5); @@ -360,6 +361,7 @@ TEST_CASE("Small Map") { { 4, 4 }, { 5, 5 } })); + REQUIRE(a.count(5) == 1); REQUIRE(a.erase(5) == 1); REQUIRE(a.size() == 4); @@ -374,6 +376,7 @@ TEST_CASE("Small Map") { { 3, 3 }, { 4, 4 } })); + REQUIRE(a.count(5) == 0); a.emplace(5, 5); REQUIRE(a.back().first == 5); @@ -390,6 +393,7 @@ TEST_CASE("Small Map") { { 4, 4 }, { 5, 5 } })); + REQUIRE(a.count(5) == 1); a.erase(std::prev(a.end())); REQUIRE(a.size() == 4); @@ -421,6 +425,7 @@ TEST_CASE("Small Map") { { 4, 4 }, { 10, 10 } })); + REQUIRE(a.count(10) == 1); REQUIRE(a.erase(10) == 1); REQUIRE(a.erase(4) == 1); @@ -435,6 +440,7 @@ TEST_CASE("Small Map") { { 2, 2 }, { 3, 3 } })); + REQUIRE(a.count(10) == 0); std::initializer_list> src = { { 6, 6 }, @@ -1535,6 +1541,7 @@ TEST_CASE("Small Multi Map") { { 3, 3 }, { 4, 4 } })); + REQUIRE(a.count(4) == 1); // NOLINTNEXTLINE(performance-move-const-arg) auto p = std::make_pair(5, 5); @@ -1553,6 +1560,7 @@ TEST_CASE("Small Multi Map") { { 4, 4 }, { 5, 5 } })); + REQUIRE(a.count(5) == 1); REQUIRE(a.erase(5) == 1); REQUIRE(a.size() == 4); @@ -1567,6 +1575,7 @@ TEST_CASE("Small Multi Map") { { 3, 3 }, { 4, 4 } })); + REQUIRE(a.count(5) == 0); a.emplace(5, 5); REQUIRE(a.back().first == 5); @@ -1583,6 +1592,7 @@ TEST_CASE("Small Multi Map") { { 4, 4 }, { 5, 5 } })); + REQUIRE(a.count(5) == 1); a.erase(std::prev(a.end())); REQUIRE(a.size() == 4); @@ -1614,6 +1624,7 @@ TEST_CASE("Small Multi Map") { { 4, 4 }, { 10, 10 } })); + REQUIRE(a.count(10) == 1); REQUIRE(a.erase(10) == 1); REQUIRE(a.erase(4) == 1); @@ -1628,6 +1639,7 @@ TEST_CASE("Small Multi Map") { { 2, 2 }, { 3, 3 } })); + REQUIRE(a.count(10) == 0); std::initializer_list> src = { { 6, 6 }, @@ -1687,6 +1699,7 @@ TEST_CASE("Small Multi Map") { { 7, 7 }, { 7, 8 } })); + REQUIRE(a.count(7) == 2); it = a.erase(a.begin() + 1); REQUIRE(it == a.begin() + 1); @@ -1731,6 +1744,7 @@ TEST_CASE("Small Multi Map") { { 1, 1 }, { 6, 6 } })); + REQUIRE(a.count(7) == 0); a.clear(); // NOLINTNEXTLINE(readability-container-size-empty) diff --git a/test/unit/small_set.cpp b/test/unit/small_set.cpp index c5e3d34..cff29f9 100644 --- a/test/unit/small_set.cpp +++ b/test/unit/small_set.cpp @@ -236,6 +236,7 @@ TEST_CASE("Small Set") { REQUIRE(a.capacity() == 5); REQUIRE_FALSE(a.empty()); REQUIRE(equal_il(a, { 1, 2, 3, 4 })); + REQUIRE(a.count(4) == 1); // NOLINTNEXTLINE(performance-move-const-arg) int p = 5; @@ -246,6 +247,7 @@ TEST_CASE("Small Set") { REQUIRE(a.capacity() == 5); REQUIRE_FALSE(a.empty()); REQUIRE(equal_il(a, { 1, 2, 3, 4, 5 })); + REQUIRE(a.count(5) == 1); REQUIRE(a.erase(5) == 1); REQUIRE(a.size() == 4); @@ -253,6 +255,7 @@ TEST_CASE("Small Set") { REQUIRE(a.capacity() == 5); REQUIRE_FALSE(a.empty()); REQUIRE(equal_il(a, { 1, 2, 3, 4 })); + REQUIRE(a.count(5) == 0); a.emplace(5); REQUIRE(a.back() == 5); @@ -261,6 +264,7 @@ TEST_CASE("Small Set") { REQUIRE(a.capacity() == 5); REQUIRE_FALSE(a.empty()); REQUIRE(equal_il(a, { 1, 2, 3, 4, 5 })); + REQUIRE(a.count(5) == 1); a.erase(std::prev(a.end())); REQUIRE(a.size() == 4); @@ -277,6 +281,7 @@ TEST_CASE("Small Set") { REQUIRE(a.capacity() == 5); REQUIRE_FALSE(a.empty()); REQUIRE(equal_il(a, { 1, 2, 3, 4, 10 })); + REQUIRE(a.count(10) == 1); REQUIRE(a.erase(10) == 1); REQUIRE(a.erase(4) == 1); @@ -285,6 +290,7 @@ TEST_CASE("Small Set") { REQUIRE(a.capacity() == 5); REQUIRE_FALSE(a.empty()); REQUIRE(equal_il(a, { 1, 2, 3 })); + REQUIRE(a.count(10) == 0); std::initializer_list src = { 6, 5, 7 }; a.insert(src.begin(), src.end()); @@ -887,6 +893,7 @@ TEST_CASE("Small Multi Set") { REQUIRE(a.capacity() == 5); REQUIRE_FALSE(a.empty()); REQUIRE(equal_il(a, { 1, 2, 3, 4, 4 })); + REQUIRE(a.count(4) == 2); // NOLINTNEXTLINE(performance-move-const-arg) int p = 5; @@ -897,6 +904,7 @@ TEST_CASE("Small Multi Set") { REQUIRE(a.capacity() >= 6); REQUIRE_FALSE(a.empty()); REQUIRE(equal_il(a, { 1, 2, 3, 4, 4, 5 })); + REQUIRE(a.count(5) == 1); REQUIRE(a.erase(5) == 1); REQUIRE(a.size() == 5); @@ -904,6 +912,7 @@ TEST_CASE("Small Multi Set") { REQUIRE(a.capacity() >= 5); REQUIRE_FALSE(a.empty()); REQUIRE(equal_il(a, { 1, 2, 3, 4, 4 })); + REQUIRE(a.count(5) == 0); a.emplace(5); REQUIRE(a.back() == 5); @@ -912,6 +921,7 @@ TEST_CASE("Small Multi Set") { REQUIRE(a.capacity() >= 6); REQUIRE_FALSE(a.empty()); REQUIRE(equal_il(a, { 1, 2, 3, 4, 4, 5 })); + REQUIRE(a.count(5) == 1); a.erase(std::prev(a.end())); REQUIRE(a.size() == 5); @@ -928,6 +938,7 @@ TEST_CASE("Small Multi Set") { REQUIRE(a.capacity() >= 6); REQUIRE_FALSE(a.empty()); REQUIRE(equal_il(a, { 1, 2, 3, 4, 4, 10 })); + REQUIRE(a.count(10) == 1); REQUIRE(a.erase(10) == 1); REQUIRE(a.erase(4) == 2); @@ -936,6 +947,7 @@ TEST_CASE("Small Multi Set") { REQUIRE(a.capacity() >= 5); REQUIRE_FALSE(a.empty()); REQUIRE(equal_il(a, { 1, 2, 3 })); + REQUIRE(a.count(4) == 0); std::initializer_list src = { 6, 5, 7 }; a.insert(src.begin(), src.end());