diff options
Diffstat (limited to 'vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/expressionbuilder.h')
-rw-r--r-- | vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/expressionbuilder.h | 60 |
1 files changed, 47 insertions, 13 deletions
diff --git a/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/expressionbuilder.h b/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/expressionbuilder.h index 20bf1358..f0889f1d 100644 --- a/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/expressionbuilder.h +++ b/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/expressionbuilder.h @@ -7,6 +7,8 @@ #ifndef IGLOO_EXPRESSIONBUILDER_H #define IGLOO_EXPRESSIONBUILDER_H +#include <cstddef> + namespace snowhouse { // ---- Evaluation of list of constraints @@ -27,7 +29,7 @@ namespace snowhouse { ExpressionBuilder(const ConstraintListType& list) : m_constraint_list(list) { } - + template <typename ExpectedType> ExpressionBuilder<typename type_concat<ConstraintListType, ConstraintList<ConstraintAdapter<EqualsConstraint<ExpectedType> >, Nil> >::t> EqualTo(const ExpectedType& expected) @@ -79,24 +81,44 @@ namespace snowhouse { return EqualTo<bool>(true); } +#if __cplusplus > 199711L + ExpressionBuilder<typename type_concat<ConstraintListType, ConstraintList<ConstraintAdapter<EqualsConstraint<std::nullptr_t> >, Nil> >::t> + Null() + { + return EqualTo<std::nullptr_t>(nullptr); + } +#endif + ExpressionBuilder<typename type_concat<ConstraintListType, ConstraintList<ConstraintAdapter<EqualsConstraint<std::string> >, Nil> >::t> EqualTo(const char* expected) { return EqualTo<std::string>(std::string(expected)); } - template <typename ExpectedType> - ExpressionBuilder<typename type_concat<ConstraintListType, ConstraintList<ConstraintAdapter<IsGreaterThanConstraint<ExpectedType> >, Nil> >::t> - GreaterThan(const ExpectedType& expected) - { - typedef ConstraintAdapter<IsGreaterThanConstraint<ExpectedType> > ConstraintAdapterType; - - typedef ExpressionBuilder< typename type_concat<ConstraintListType, ConstraintList<ConstraintAdapterType, Nil> >::t > BuilderType; - ConstraintAdapterType constraint(expected); - ConstraintList<ConstraintAdapterType, Nil> node(constraint, Nil()); - return BuilderType(Concatenate(m_constraint_list, node)); - } - + template <typename ExpectedType> + ExpressionBuilder<typename type_concat<ConstraintListType, ConstraintList<ConstraintAdapter<IsGreaterThanConstraint<ExpectedType> >, Nil> >::t> + GreaterThan(const ExpectedType& expected) + { + typedef ConstraintAdapter<IsGreaterThanConstraint<ExpectedType> > ConstraintAdapterType; + + typedef ExpressionBuilder< typename type_concat<ConstraintListType, ConstraintList<ConstraintAdapterType, Nil> >::t > BuilderType; + ConstraintAdapterType constraint(expected); + ConstraintList<ConstraintAdapterType, Nil> node(constraint, Nil()); + return BuilderType(Concatenate(m_constraint_list, node)); + } + + template <typename ExpectedType> + ExpressionBuilder<typename type_concat<ConstraintListType, ConstraintList<ConstraintAdapter<IsGreaterThanOrEqualToConstraint<ExpectedType> >, Nil> >::t> + GreaterThanOrEqualTo(const ExpectedType& expected) + { + typedef ConstraintAdapter<IsGreaterThanOrEqualToConstraint<ExpectedType> > ConstraintAdapterType; + + typedef ExpressionBuilder< typename type_concat<ConstraintListType, ConstraintList<ConstraintAdapterType, Nil> >::t > BuilderType; + ConstraintAdapterType constraint(expected); + ConstraintList<ConstraintAdapterType, Nil> node(constraint, Nil()); + return BuilderType(Concatenate(m_constraint_list, node)); + } + template <typename ExpectedType> ExpressionBuilder<typename type_concat<ConstraintListType, ConstraintList<ConstraintAdapter<IsLessThanConstraint<ExpectedType> >, Nil> >::t> LessThan(const ExpectedType& expected) @@ -109,6 +131,18 @@ namespace snowhouse { return BuilderType(Concatenate(m_constraint_list, node)); } + template <typename ExpectedType> + ExpressionBuilder<typename type_concat<ConstraintListType, ConstraintList<ConstraintAdapter<IsLessThanOrEqualToConstraint<ExpectedType> >, Nil> >::t> + LessThanOrEqualTo(const ExpectedType& expected) + { + typedef ConstraintAdapter<IsLessThanOrEqualToConstraint<ExpectedType> > ConstraintAdapterType; + + typedef ExpressionBuilder< typename type_concat<ConstraintListType, ConstraintList<ConstraintAdapterType, Nil> >::t > BuilderType; + ConstraintAdapterType constraint(expected); + ConstraintList<ConstraintAdapterType, Nil> node(constraint, Nil()); + return BuilderType(Concatenate(m_constraint_list, node)); + } + template <typename ExpectedType> ExpressionBuilder<typename type_concat<ConstraintListType, ConstraintList<ConstraintAdapter<ContainsConstraint<ExpectedType> >, Nil> >::t> Containing(const ExpectedType& expected) |