From 062cd07342edc2b003555e90dd2cee0514b9f64a Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Mon, 23 Feb 2015 09:11:55 +0100 Subject: Add BanditCpp 1.1.4 test harness --- .../snowhouse/constraints/islessthanconstraint.h | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/islessthanconstraint.h (limited to 'vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/islessthanconstraint.h') diff --git a/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/islessthanconstraint.h b/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/islessthanconstraint.h new file mode 100644 index 00000000..7379dcf7 --- /dev/null +++ b/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/islessthanconstraint.h @@ -0,0 +1,54 @@ + +// 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_ISLESSTHANCONSTRAINT_H +#define IGLOO_ISLESSTHANCONSTRAINT_H + +#include "./expressions/expression.h" + +namespace snowhouse { + + template< typename ExpectedType > + struct IsLessThanConstraint : Expression< IsLessThanConstraint > + { + IsLessThanConstraint(const ExpectedType& expected) + : m_expected(expected) + { + } + + template + bool operator()(const ActualType& actual) const + { + return (actual < m_expected); + } + + ExpectedType m_expected; + }; + + template< typename ExpectedType > + inline IsLessThanConstraint IsLessThan(const ExpectedType& expected) + { + return IsLessThanConstraint(expected); + } + + inline IsLessThanConstraint IsLessThan(const char* expected) + { + return IsLessThanConstraint(expected); + } + + template< typename ExpectedType > + struct Stringizer< IsLessThanConstraint< ExpectedType > > + { + static std::string ToString(const IsLessThanConstraint& constraint) + { + std::ostringstream builder; + builder << "less than " << snowhouse::Stringize(constraint.m_expected); + + return builder.str(); + } + }; +} +#endif -- cgit v1.2.3