diff options
author | Bardur Arantsson <bardur@scientician.net> | 2015-08-01 16:35:25 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2015-09-14 05:58:27 +0200 |
commit | 7b9f4e4e8169ca2fad3a1c7ca03f07ecfc46678e (patch) | |
tree | 0cef1ac0dc228b621afc90bc94e4e0dddcb90c82 /vendor/bandit/bandit/assertion_frameworks/matchers/BeLessThan.h | |
parent | c6196b25d119a10e79deedef26a73e0d5a021b0e (diff) |
Bandit 2.0.0
Diffstat (limited to 'vendor/bandit/bandit/assertion_frameworks/matchers/BeLessThan.h')
-rw-r--r-- | vendor/bandit/bandit/assertion_frameworks/matchers/BeLessThan.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/BeLessThan.h b/vendor/bandit/bandit/assertion_frameworks/matchers/BeLessThan.h new file mode 100644 index 00000000..87a2dc5e --- /dev/null +++ b/vendor/bandit/bandit/assertion_frameworks/matchers/BeLessThan.h @@ -0,0 +1,39 @@ +#ifndef BANDIT_BELESSTHAN_H +#define BANDIT_BELESSTHAN_H + +#include "Matcher.h" + +namespace bandit { namespace Matchers { + + template<typename T> + class BeLessThan : public Matcher + { + public: + explicit BeLessThan(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 less than <" << _expectedValue << ">"; + return ss.str(); + } + + private: + const T& _expectedValue; + }; + + template<typename T> + BeLessThan<T> be_less_than(const T& expectedValue) + { + return BeLessThan<T>(expectedValue); + } +}} + +#endif // BANDIT_BELESSTHAN_H |