summaryrefslogtreecommitdiff
path: root/vendor/bandit/bandit/assertion_frameworks/matchers/BeGreaterThan.h
blob: 95d93d1e091b59cd71dfd32d901db668fbdbeade (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef BANDIT_BEGREATERTHAN_H
#define BANDIT_BEGREATERTHAN_H

#include "Matcher.h"

namespace bandit { namespace Matchers {

    template<typename T>
    class BeGreaterThan : public Matcher
    {
    public:
        explicit BeGreaterThan(const T& expectedValue) : Matcher(), _expectedValue(expectedValue) {}

        template<typename U>
        bool matches(const U& actualValue) const
	{
	    return actualValue > _expectedValue;
	}

    protected:
        virtual std::string failure_message_end() const
	{
	    std::ostringstream ss;
	    ss << "be greater than <" << _expectedValue << ">";
	    return ss.str();
	}

    private:
        const T& _expectedValue;
    };

    template<typename T>
    BeGreaterThan<T> be_greater_than(const T& expectedValue)
    {
        return BeGreaterThan<T>(expectedValue);
    }
}}

#endif	// BANDIT_BEGREATERTHAN_H