Sha256: 052182119d4c6fb7550a3a7f50c68f43fc2f8ad0ea5ebdb9b9da12b21862620b
Contents?: true
Size: 1.54 KB
Versions: 2
Compression:
Stored size: 1.54 KB
Contents
// Copyright Joakim Karlsson & Kim Gräsman 2010-2012. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef IGLOO_ISLESSTHANOREQUALTOCONSTRAINT_H #define IGLOO_ISLESSTHANOREQUALTOCONSTRAINT_H #include "./expressions/expression.h" namespace snowhouse { template< typename ExpectedType > struct IsLessThanOrEqualToConstraint : Expression < IsLessThanOrEqualToConstraint<ExpectedType> > { IsLessThanOrEqualToConstraint(const ExpectedType& expected) : m_expected(expected) { } template<typename ActualType> bool operator()(const ActualType& actual) const { return (actual <= m_expected); } ExpectedType m_expected; }; template< typename ExpectedType > inline IsLessThanOrEqualToConstraint<ExpectedType> IsLessThanOrEqualTo(const ExpectedType& expected) { return IsLessThanOrEqualToConstraint<ExpectedType>(expected); } inline IsLessThanOrEqualToConstraint<std::string> IsLessThanOrEqualTo(const char* expected) { return IsLessThanOrEqualToConstraint<std::string>(expected); } template< typename ExpectedType > struct Stringizer < IsLessThanOrEqualToConstraint< ExpectedType > > { static std::string ToString(const IsLessThanOrEqualToConstraint<ExpectedType>& constraint) { std::ostringstream builder; builder << "less than or equal to " << snowhouse::Stringize(constraint.m_expected); return builder.str(); } }; } #endif
Version data entries
2 entries across 2 versions & 1 rubygems