Sha256: 4f53f523a1159bfe3dc0937583f9ebdb0d96ac19b50637d7a804545bab2cc518

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 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_ISGREATERTHANCONSTRAINT_H
#define IGLOO_ISGREATERTHANCONSTRAINT_H

#include "./expressions/expression.h"

namespace snowhouse {

  template< typename ExpectedType >
  struct IsGreaterThanConstraint : Expression< IsGreaterThanConstraint<ExpectedType> >
  {
    IsGreaterThanConstraint(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 IsGreaterThanConstraint<ExpectedType> IsGreaterThan(const ExpectedType& expected)
  {
    return IsGreaterThanConstraint<ExpectedType>(expected);
  }

  inline IsGreaterThanConstraint<std::string> IsGreaterThan(const char* expected)
  {
    return IsGreaterThanConstraint<std::string>(expected);
  }

  template< typename ExpectedType >
  struct Stringizer< IsGreaterThanConstraint< ExpectedType > >
  {
    static std::string ToString(const IsGreaterThanConstraint<ExpectedType>& constraint)
    {
      std::ostringstream builder;
	  builder << "greater than " << snowhouse::Stringize(constraint.m_expected);

      return builder.str();
    }
  };
}

#endif

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tree-sitter-0.1.0 ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/isgreaterthanconstraint.h
tree-sitter-0.0.1 ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/isgreaterthanconstraint.h