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 --- .../constraints/expressions/andexpression.h | 46 ++++++++++++++++++++++ .../snowhouse/constraints/expressions/expression.h | 38 ++++++++++++++++++ .../constraints/expressions/expression_fwd.h | 15 +++++++ .../constraints/expressions/notexpression.h | 44 +++++++++++++++++++++ .../constraints/expressions/orexpression.h | 46 ++++++++++++++++++++++ 5 files changed, 189 insertions(+) create mode 100644 vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/andexpression.h create mode 100644 vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/expression.h create mode 100644 vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/expression_fwd.h create mode 100644 vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/notexpression.h create mode 100644 vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/orexpression.h (limited to 'vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions') diff --git a/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/andexpression.h b/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/andexpression.h new file mode 100644 index 00000000..8b6b7d12 --- /dev/null +++ b/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/andexpression.h @@ -0,0 +1,46 @@ + +// 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_ANDEXPRESSION_H +#define IGLOO_ANDEXPRESSION_H + +#include "./expression_fwd.h" + +namespace snowhouse { + + template< typename LeftExpression, typename RightExpression > + struct AndExpression : Expression< AndExpression > + { + AndExpression(const LeftExpression& left, const RightExpression& right) + : m_left(left) + , m_right(right) + { + } + + template< typename ActualType > + bool operator()(const ActualType& actual) const + { + return (m_left(actual) && m_right(actual)); + } + + LeftExpression m_left; + RightExpression m_right; + }; + + template< typename LeftExpression, typename RightExpression > + struct Stringizer< AndExpression > + { + static std::string ToString(const AndExpression& expression) + { + std::ostringstream builder; + builder << Stringize(expression.m_left) << " and " << Stringize(expression.m_right); + + return builder.str(); + } + }; +} + +#endif diff --git a/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/expression.h b/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/expression.h new file mode 100644 index 00000000..fa894818 --- /dev/null +++ b/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/expression.h @@ -0,0 +1,38 @@ + +// 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_EXPRESSION_H +#define IGLOO_EXPRESSION_H + +#include "./notexpression.h" +#include "./andexpression.h" +#include "./orexpression.h" + +namespace snowhouse { + + template + struct Expression + { + NotExpression operator!() const + { + return NotExpression(static_cast(*this)); + } + + template< typename Right > + AndExpression operator&&(const Right& right) const + { + return AndExpression(static_cast(*this), right); + } + + template< typename Right > + OrExpression operator||(const Right& right) const + { + return OrExpression(static_cast(*this), right); + } + }; +} + +#endif diff --git a/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/expression_fwd.h b/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/expression_fwd.h new file mode 100644 index 00000000..c0e3706e --- /dev/null +++ b/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/expression_fwd.h @@ -0,0 +1,15 @@ + +// 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_EXPRESSION_FWD_H +#define IGLOO_EXPRESSION_FWD_H + +namespace snowhouse { + template + struct Expression; +} + +#endif diff --git a/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/notexpression.h b/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/notexpression.h new file mode 100644 index 00000000..4785f07b --- /dev/null +++ b/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/notexpression.h @@ -0,0 +1,44 @@ + +// 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_NOTEXPRESSION_H +#define IGLOO_NOTEXPRESSION_H + +#include "./expression_fwd.h" + +namespace snowhouse { + + template< typename ExpressionType > + struct NotExpression : Expression< NotExpression > + { + NotExpression(const ExpressionType& expression) + : m_expression(expression) + { + } + + template + bool operator()(const ActualType& actual) const + { + return !m_expression(actual); + } + + ExpressionType m_expression; + }; + + template< typename ExpressionType > + struct Stringizer< NotExpression > + { + static std::string ToString(const NotExpression& expression) + { + std::ostringstream builder; + builder << "not " << snowhouse::Stringize(expression.m_expression); + + return builder.str(); + } + }; +} + +#endif diff --git a/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/orexpression.h b/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/orexpression.h new file mode 100644 index 00000000..c1b6c12b --- /dev/null +++ b/vendor/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/orexpression.h @@ -0,0 +1,46 @@ + +// 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_OREXPRESSION_H +#define IGLOO_OREXPRESSION_H + +#include "./expression_fwd.h" + +namespace snowhouse { + + template< typename LeftExpression, typename RightExpression > + struct OrExpression : Expression< OrExpression > + { + OrExpression(const LeftExpression& left, const RightExpression& right) + : m_left(left) + , m_right(right) + { + } + + template< typename ActualType > + bool operator()(const ActualType& actual) const + { + return (m_left(actual) || m_right(actual)); + } + + LeftExpression m_left; + RightExpression m_right; + }; + + template< typename LeftExpression, typename RightExpression > + struct Stringizer< OrExpression > + { + static std::string ToString(const OrExpression& expression) + { + std::ostringstream builder; + builder << snowhouse::Stringize(expression.m_left) << " or " << snowhouse::Stringize(expression.m_right); + + return builder.str(); + } + }; +} + +#endif -- cgit v1.2.3