7 #ifndef IGLOO_CONTAINSCONSTRAINT_H 8 #define IGLOO_CONTAINSCONSTRAINT_H 12 #include "./expressions/expression.h" 16 template <
typename ContainerType>
19 template <
typename ExpectedType>
20 static bool find(
const ContainerType& container,
const ExpectedType& expected)
22 return std::find(container.begin(), container.end(), expected) != container.end();
26 template <
typename KeyType,
typename ValueType>
29 template <
typename ExpectedType>
30 static bool find(
const std::map<KeyType, ValueType>& container,
const ExpectedType& expected)
32 return container.find(expected) != container.end();
36 template <
typename ExpectedType>
40 : m_expected(expected) {}
42 template <
typename ActualType>
43 bool operator()(
const ActualType& actual)
const 48 bool operator()(
const std::string& actual)
const 50 return actual.find(m_expected) != actual.npos;
53 ExpectedType m_expected;
56 template<
typename ExpectedType >
67 template<
typename ExpectedType >
72 std::ostringstream builder;
73 builder <<
"contains " << snowhouse::Stringize(constraint.m_expected);
Definition: stringize.h:71
Definition: containsconstraint.h:37
Definition: containsconstraint.h:17
Definition: expression.h:17