Sha256: fd19d1c0cae19bdcfb4fd6f09e5f3d673ee45d8fc3652205599e58e6c2fdfe3c

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 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_ATMOSTOPERATOR_H
#define IGLOO_ATMOSTOPERATOR_H

namespace snowhouse {

   struct AtMostOperator : public CollectionOperator
   {
      AtMostOperator(unsigned int expected) : m_expected(expected) {}

      template <typename ConstraintListType, typename ActualType>
      void Evaluate(ConstraintListType& list, ResultStack& result, OperatorStack& operators, const ActualType& actual)
      {
        unsigned int passed_elements = CollectionConstraintEvaluator<ConstraintListType, ActualType>::Evaluate(*this, list, result, operators, actual);

         result.push(passed_elements <= m_expected); 
      }

      unsigned int m_expected;
   };

   template<>
   struct Stringizer<AtMostOperator>
   {
      static std::string ToString(const AtMostOperator& op)
      {
         std::ostringstream stm;
         stm << "at most " << op.m_expected;
         return stm.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/fluent/operators/collections/atmostoperator.h
tree-sitter-0.0.1 ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/operators/collections/atmostoperator.h