add contains function #25

This commit is contained in:
2019-05-31 22:40:29 +07:00
parent 16e6a2d082
commit 8237a106ea
8 changed files with 72 additions and 0 deletions

View File

@@ -423,6 +423,9 @@ TEST_CASE("flat_multimap") {
REQUIRE(my_as_const(s0).find(3) == s0.cbegin() + 2);
REQUIRE(s0.find(6) == s0.end());
REQUIRE(my_as_const(s0).find(0) == s0.cend());
REQUIRE(my_as_const(s0).contains(1));
REQUIRE(my_as_const(s0).contains(3));
REQUIRE_FALSE(my_as_const(s0).contains(0));
}
{
map_t s0{{1,2},{2,3},{2,1},{3,4},{4,5},{5,6}};
@@ -447,6 +450,9 @@ TEST_CASE("flat_multimap") {
REQUIRE(s0.find(std::string_view("42")) == s0.end());
REQUIRE(my_as_const(s0).find(std::string_view("42")) == s0.cend());
REQUIRE(my_as_const(s0).contains(std::string_view("hello")));
REQUIRE_FALSE(my_as_const(s0).contains(std::string_view("42")));
REQUIRE(my_as_const(s0).count(std::string_view("hello")) == 1);
REQUIRE(my_as_const(s0).count(std::string_view("hello_42")) == 0);