aboutsummaryrefslogtreecommitdiff
path: root/absl/algorithm/container_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/algorithm/container_test.cc')
-rw-r--r--absl/algorithm/container_test.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/absl/algorithm/container_test.cc b/absl/algorithm/container_test.cc
index c01f5fc0..7e54e2b2 100644
--- a/absl/algorithm/container_test.cc
+++ b/absl/algorithm/container_test.cc
@@ -113,6 +113,11 @@ TEST_F(NonMutatingTest, FindReturnsCorrectType) {
absl::c_find(absl::implicit_cast<const std::list<int>&>(sequence_), 3);
}
+TEST_F(NonMutatingTest, Contains) {
+ EXPECT_TRUE(absl::c_contains(container_, 3));
+ EXPECT_FALSE(absl::c_contains(container_, 4));
+}
+
TEST_F(NonMutatingTest, FindIf) { absl::c_find_if(container_, Predicate); }
TEST_F(NonMutatingTest, FindIfNot) {
@@ -305,6 +310,17 @@ TEST_F(NonMutatingTest, SearchWithPredicate) {
absl::c_search(vector_, sequence_, BinPredicate);
}
+TEST_F(NonMutatingTest, ContainsSubrange) {
+ EXPECT_TRUE(absl::c_contains_subrange(sequence_, vector_));
+ EXPECT_TRUE(absl::c_contains_subrange(vector_, sequence_));
+ EXPECT_TRUE(absl::c_contains_subrange(array_, sequence_));
+}
+
+TEST_F(NonMutatingTest, ContainsSubrangeWithPredicate) {
+ EXPECT_TRUE(absl::c_contains_subrange(sequence_, vector_, Equals));
+ EXPECT_TRUE(absl::c_contains_subrange(vector_, sequence_, Equals));
+}
+
TEST_F(NonMutatingTest, SearchN) { absl::c_search_n(sequence_, 3, 1); }
TEST_F(NonMutatingTest, SearchNWithPredicate) {