diff options
author | Bardur Arantsson <bardur@scientician.net> | 2015-10-27 19:25:50 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2015-10-27 19:25:50 +0100 |
commit | 867823f4429b1215cd5c3aa6d2415fb324429891 (patch) | |
tree | 2915f6c2e0acae69ad2b738e0038766354d60856 /vendor/bandit/bandit/assertion_frameworks/matchers/BeGreaterThan.h | |
parent | f005efee43bdb2e9749b02f73b876bf2c1145f1b (diff) | |
parent | 47fb7807d77c92fa6e72017501d9355d780adf40 (diff) |
Merge branch 'cpp'
Diffstat (limited to 'vendor/bandit/bandit/assertion_frameworks/matchers/BeGreaterThan.h')
-rw-r--r-- | vendor/bandit/bandit/assertion_frameworks/matchers/BeGreaterThan.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/BeGreaterThan.h b/vendor/bandit/bandit/assertion_frameworks/matchers/BeGreaterThan.h new file mode 100644 index 00000000..95d93d1e --- /dev/null +++ b/vendor/bandit/bandit/assertion_frameworks/matchers/BeGreaterThan.h @@ -0,0 +1,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 |