diff options
-rw-r--r-- | src/strings/base.tcc | 2 | ||||
-rw-r--r-- | src/strings/base_test.cpp | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/strings/base.tcc b/src/strings/base.tcc index cde277f..491b4ca 100644 --- a/src/strings/base.tcc +++ b/src/strings/base.tcc @@ -261,7 +261,7 @@ namespace strings template<class T, class O, class P> bool _crtp_string<T, O, P>::contains_any(XPair s) const { - return std::find_if(s.begin(), s.end(), [this](char c) { return this->contains(c); }) != end(); + return std::find_if(s.begin(), s.end(), [this](char c) { return this->contains(c); }) != s.end(); } template<class T, class O, class P> diff --git a/src/strings/base_test.cpp b/src/strings/base_test.cpp index 836ea4b..cb41fa9 100644 --- a/src/strings/base_test.cpp +++ b/src/strings/base_test.cpp @@ -1,4 +1,7 @@ #include "base.hpp" + +#include <gtest/gtest.h> + #include "vstring.hpp" #include "xstring.hpp" #include "fstring.hpp" @@ -16,3 +19,10 @@ static_assert(!string_comparison_allowed<_test, _test2>::value, "t2"); static_assert(string_comparison_allowed<VString<1>, XString>::value, "vx"); static_assert(string_comparison_allowed<XString, XString>::value, "xx"); static_assert(string_comparison_allowed<XString, FString>::value, "xf"); + +TEST(strings, contains) +{ + XString hi = "Hello"; + EXPECT_TRUE(hi.contains_any("Hi")); + EXPECT_FALSE(hi.contains_any("hi")); +} |