summaryrefslogtreecommitdiff
path: root/vendor/bandit/bandit/assertion_frameworks/matchers
diff options
context:
space:
mode:
authorManoj Srivastava <srivasta@debian.org>2020-05-22 19:57:41 -0700
committerManoj Srivastava <srivasta@debian.org>2020-05-22 20:02:19 -0700
commitc3d2579ad8d7eb33059aa8fdbaf5b564411a57f2 (patch)
tree1570cda0676fdcf4171a69a7fe313c1b89a52b0c /vendor/bandit/bandit/assertion_frameworks/matchers
parent986b7742bf244b4073ecca0723615f70be8a1ab6 (diff)
parent4e9b9c402ed95bf9a17fd6d795bc49bb4128a6fa (diff)
Merge branch 'upstream' into debian-cmake-fixes
Diffstat (limited to 'vendor/bandit/bandit/assertion_frameworks/matchers')
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/BeCloseTo.h55
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/BeEmpty.h32
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/BeFalsy.h39
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/BeGTE.h45
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/BeGreaterThan.h39
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/BeLTE.h45
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/BeLessThan.h39
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/BeNull.h29
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/BeTruthy.h35
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/Contain.h58
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/Equal.h90
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/MatchProxy.h43
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/Matcher.h74
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/MatcherException.h16
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/ThrowException.h60
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/ValueProxy.h26
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/matchers.h19
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/matchers/must.h36
18 files changed, 780 insertions, 0 deletions
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/BeCloseTo.h b/vendor/bandit/bandit/assertion_frameworks/matchers/BeCloseTo.h
new file mode 100644
index 00000000..e4507c4c
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/BeCloseTo.h
@@ -0,0 +1,55 @@
+#ifndef BANDIT_BECLOSETO_H
+#define BANDIT_BECLOSETO_H
+
+#include "Matcher.h"
+
+namespace bandit { namespace Matchers {
+
+ template<typename T>
+ class BeCloseTo : public Matcher
+ {
+ public:
+ explicit BeCloseTo(const T& expectedValue): Matcher(), _expectedValue(expectedValue), _threshold(0.01) {}
+
+ BeCloseTo<T>& within(float threshold)
+ {
+ _threshold = threshold;
+ return *this;
+ }
+
+ template<typename U>
+ bool matches(const U& actualValue) const
+ {
+ return this->subtractable_types_match(actualValue, _expectedValue);
+ }
+
+
+ protected:
+ virtual std::string failure_message_end() const
+ {
+ std::ostringstream ss;
+ ss << "be close to <" << _expectedValue << ">" << " (within " << _threshold << ")";
+ return ss.str();
+ }
+
+ private:
+ template<typename U, typename V>
+ bool subtractable_types_match(const U& actualValue, const V& expectedValue) const
+ {
+ return (actualValue > (expectedValue - _threshold)) && (actualValue < (expectedValue + _threshold));
+ }
+
+
+ private:
+ const T& _expectedValue;
+ float _threshold;
+ };
+
+ template<typename T>
+ BeCloseTo<T> be_close_to(const T& expectedValue)
+ {
+ return BeCloseTo<T>(expectedValue);
+ }
+}}
+
+#endif // BANDIT_BECLOSETO_H
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/BeEmpty.h b/vendor/bandit/bandit/assertion_frameworks/matchers/BeEmpty.h
new file mode 100644
index 00000000..a83ef994
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/BeEmpty.h
@@ -0,0 +1,32 @@
+#ifndef BANDIT_BEEMPTY_H
+#define BANDIT_BEEMPTY_H
+
+#include "Matcher.h"
+
+namespace bandit { namespace Matchers {
+
+ class BeEmpty : public Matcher
+ {
+ private:
+ // BeEmpty & operator=(const BeEmpty &);
+
+ public:
+ explicit BeEmpty() : Matcher() {}
+
+ template<typename U>
+ bool matches(const U& container) const
+ {
+ return container.empty();
+ }
+
+ protected:
+ std::string failure_message_end() const
+ {
+ return std::string("be empty");
+ }
+ };
+
+ static const BeEmpty be_empty = BeEmpty();
+}}
+
+#endif // BANDIT_BEEMPTY_H
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/BeFalsy.h b/vendor/bandit/bandit/assertion_frameworks/matchers/BeFalsy.h
new file mode 100644
index 00000000..718c6366
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/BeFalsy.h
@@ -0,0 +1,39 @@
+#ifndef BANDIT_BEFALSY_H
+#define BANDIT_BEFALSY_H
+
+#include "Matcher.h"
+
+namespace bandit { namespace Matchers {
+
+ class BeFalsy : public Matcher
+ {
+ private:
+ // BeFalsy& operator=(const BeFalsy&);
+
+ public:
+ explicit BeFalsy() : Matcher() {}
+ // ~BeFalsy() {}
+
+ template<typename U>
+ bool matches(const U& actualValue) const
+ {
+ return !actualValue;
+ }
+
+ bool matches(const std::nullptr_t&) const
+ {
+ return true;
+ }
+
+
+ protected:
+ virtual std::string failure_message_end() const
+ {
+ return std::string("evaluate to false");
+ }
+ };
+
+ static const BeFalsy be_falsy = BeFalsy();
+}}
+
+#endif // BANDIT_BEFALSY_H
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/BeGTE.h b/vendor/bandit/bandit/assertion_frameworks/matchers/BeGTE.h
new file mode 100644
index 00000000..072b2caf
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/BeGTE.h
@@ -0,0 +1,45 @@
+#ifndef BANDIT_BEGREATERTHANOREQUAL_H
+#define BANDIT_BEGREATERTHANOREQUAL_H
+
+#include "Matcher.h"
+
+namespace bandit { namespace Matchers {
+
+ template<typename T>
+ class BeGTE : public Matcher
+ {
+ public:
+ explicit BeGTE(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 or equal to <" << _expectedValue << ">";
+ return ss.str();
+ }
+
+ private:
+ const T& _expectedValue;
+ };
+
+ template<typename T>
+ BeGTE<T> be_gte(const T& expectedValue)
+ {
+ return BeGTE<T>(expectedValue);
+ }
+
+ template<typename T>
+ BeGTE<T> be_greater_than_or_equal_to(const T& expectedValue)
+ {
+ return be_gte(expectedValue);
+ }
+}}
+
+#endif // BANDIT_BEGREATERTHANOREQUAL_H
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
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/BeLTE.h b/vendor/bandit/bandit/assertion_frameworks/matchers/BeLTE.h
new file mode 100644
index 00000000..83463f75
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/BeLTE.h
@@ -0,0 +1,45 @@
+#ifndef BANDIT_BELESSTHANOREQUAL_H
+#define BANDIT_BELESSTHANOREQUAL_H
+
+#include "Matcher.h"
+
+namespace bandit { namespace Matchers {
+
+ template<typename T>
+ class BeLTE : public Matcher
+ {
+ public:
+ explicit BeLTE(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 or equal to <" << _expectedValue << ">";
+ return ss.str();
+ }
+
+ private:
+ const T& _expectedValue;
+ };
+
+ template<typename T>
+ BeLTE<T> be_lte(const T& expectedValue)
+ {
+ return BeLTE<T>(expectedValue);
+ }
+
+ template<typename T>
+ BeLTE<T> be_less_than_or_equal_to(const T& expectedValue)
+ {
+ return be_lte(expectedValue);
+ }
+}}
+
+#endif // BANDIT_BELESSTHANOREQUAL_H
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
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/BeNull.h b/vendor/bandit/bandit/assertion_frameworks/matchers/BeNull.h
new file mode 100644
index 00000000..6e034d10
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/BeNull.h
@@ -0,0 +1,29 @@
+#ifndef BANDIT_BENULL_H
+#define BANDIT_BENULL_H
+
+#include "Matcher.h"
+
+namespace bandit { namespace Matchers {
+
+ class BeNull : public Matcher
+ {
+ public:
+ BeNull() : Matcher() {}
+
+ template<typename U>
+ bool matches(U *const & actualValue) const
+ {
+ return !actualValue;
+ }
+
+ protected:
+ std::string failure_message_end() const
+ {
+ return std::string("be nil");
+ }
+ };
+
+ static const BeNull be_null = BeNull();
+}}
+
+#endif // BANDIT_BENULL_H
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/BeTruthy.h b/vendor/bandit/bandit/assertion_frameworks/matchers/BeTruthy.h
new file mode 100644
index 00000000..c8652538
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/BeTruthy.h
@@ -0,0 +1,35 @@
+#ifndef BANDIT_BETRUTHY_H
+#define BANDIT_BETRUTHY_H
+
+#include "Matcher.h"
+
+namespace bandit { namespace Matchers {
+
+ class BeTruthy : public Matcher
+ {
+ public:
+ BeTruthy() : Matcher() {}
+
+ template<typename U>
+ bool matches(const U& actualValue) const
+ {
+ return !!actualValue;
+ }
+
+ bool matches(const std::nullptr_t&) const
+ {
+ return false;
+ }
+
+
+ protected:
+ virtual std::string failure_message_end() const
+ {
+ return std::string("evaluate to true");
+ }
+ };
+
+ static const BeTruthy be_truthy = BeTruthy();
+}}
+
+#endif // BANDIT_BETRUTHY_H
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/Contain.h b/vendor/bandit/bandit/assertion_frameworks/matchers/Contain.h
new file mode 100644
index 00000000..f048e3a3
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/Contain.h
@@ -0,0 +1,58 @@
+#ifndef BANDIT_CONTAIN_H
+#define BANDIT_CONTAIN_H
+
+#include <cstring>
+#include <vector>
+
+#include "Matcher.h"
+
+namespace bandit { namespace Matchers {
+
+ template<typename T>
+ class Contain : public Matcher
+ {
+ public:
+ explicit Contain(const T& element) : Matcher(), _element(element) {}
+
+ template<typename U>
+ bool matches(const U& container) const
+ {
+ return container.find(_element) != container.end();
+ }
+
+ template<typename U>
+ bool matches(const std::vector<U>& container) const
+ {
+ return std::find(container.begin(), container.end(), _element) != container.end();
+ }
+
+ bool matches(const char *const container) const
+ {
+ return (_element != NULL) && (container != NULL) && (strstr(container, _element) != NULL);
+ }
+
+ bool matches(char *const container) const
+ {
+ return (_element != NULL) && (container != NULL) && (strstr(container, _element) != NULL);
+ }
+
+ protected:
+ std::string failure_message_end() const
+ {
+ std::ostringstream ss;
+ ss << "contain <" << _element << ">";
+ return ss.str();
+ }
+
+ private:
+ const T& _element;
+ };
+
+ template<typename T>
+ Contain<T> contain(const T& element)
+ {
+ return Contain<T>(element);
+ }
+}}
+
+#endif // BANDIT_CONTAIN_H
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/Equal.h b/vendor/bandit/bandit/assertion_frameworks/matchers/Equal.h
new file mode 100644
index 00000000..521c6008
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/Equal.h
@@ -0,0 +1,90 @@
+#ifndef BANDIT_EQUAL_H
+#define BANDIT_EQUAL_H
+
+#include <cstring>
+#include <memory>
+
+#include "Matcher.h"
+
+namespace bandit { namespace Matchers {
+
+ template<typename T>
+ std::ostream& operator<<(std::ostream& os, const std::unique_ptr<T>& obj)
+ {
+ return os << *obj;
+ }
+
+ template<typename T>
+ class Equal : public Matcher
+ {
+ public:
+ explicit Equal(const T& expectedValue) : Matcher(), _expectedValue(expectedValue) {}
+
+ template<typename U>
+ bool matches(const U& actualValue) const
+ {
+ return actualValue == _expectedValue;
+ }
+
+ bool matches(char* actualValue) const
+ {
+ return strcmp(actualValue, &*_expectedValue) == 0;
+ }
+
+ bool matches(const char* actualValue) const
+ {
+ return strcmp(actualValue, &*_expectedValue) == 0;
+ }
+
+ template<typename U>
+ bool matches(const std::unique_ptr<U>& pointer) const
+ {
+ return matches(pointer.get());
+ }
+
+ protected:
+ virtual std::string failure_message_end() const
+ {
+ std::ostringstream ss;
+ ss << "equal <" << _expectedValue << ">";
+ return ss.str();
+ }
+
+ private:
+ const T& _expectedValue;
+ };
+
+ template<typename T>
+ Equal<T> equal(const T& expectedValue)
+ {
+ return Equal<T>(expectedValue);
+ }
+
+ template<typename T, typename U>
+ bool operator==(const ValueProxy<T>& actualValue, const U& expectedValue)
+ {
+ return actualValue.to == expectedValue;
+ }
+
+ template<typename T, typename U>
+ bool operator==(const MatchProxy<T>& matchProxy, const U& expectedValue)
+ {
+ matchProxy(equal(expectedValue));
+ return true;
+ }
+
+ template<typename T, typename U>
+ bool operator!=(const ValueProxy<T>& actualValue, const U& expectedValue)
+ {
+ return actualValue.to != expectedValue;
+ }
+
+ template<typename T, typename U>
+ bool operator!=(const MatchProxy<T>& matchProxy, const U& expectedValue)
+ {
+ matchProxy.negate()(equal(expectedValue));
+ return true;
+ }
+}}
+
+#endif // BANDIT_EQUAL_H
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/MatchProxy.h b/vendor/bandit/bandit/assertion_frameworks/matchers/MatchProxy.h
new file mode 100644
index 00000000..b637ef0d
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/MatchProxy.h
@@ -0,0 +1,43 @@
+#ifndef BANDIT_MATCHPROXY_H
+#define BANDIT_MATCHPROXY_H
+
+#include "MatcherException.h"
+
+namespace bandit { namespace Matchers
+{
+ template<typename T> class ValueProxy;
+
+ template<typename T>
+ class MatchProxy
+ {
+ private:
+ template<typename U>
+ MatchProxy(const MatchProxy<U>&);
+
+ template<typename U>
+ MatchProxy& operator=(const MatchProxy<U>&);
+
+ public:
+ explicit MatchProxy(const ValueProxy<T>& value, bool negate_ = false) : _value(value), _negate(negate_) {}
+
+ template<typename MatcherType>
+ void operator()(const MatcherType& matcher) const
+ {
+ if( matcher.matches(_value._value) == _negate )
+ {
+ throw MatcherException(_value._filename, _value._lineNumber, matcher.failure_message(_value._value, _negate));
+ }
+ }
+
+ MatchProxy<T> negate() const
+ {
+ return MatchProxy<T>(_value, !_negate);
+ }
+
+ private:
+ const ValueProxy<T>& _value;
+ bool _negate;
+ };
+}}
+
+#endif // BANDIT_MATCHPROXY_H
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/Matcher.h b/vendor/bandit/bandit/assertion_frameworks/matchers/Matcher.h
new file mode 100644
index 00000000..ad48c0a5
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/Matcher.h
@@ -0,0 +1,74 @@
+#ifndef BANDIT_MATCHER_H
+#define BANDIT_MATCHER_H
+
+#include <sstream>
+
+//#import "CedarStringifiers.h"
+
+namespace bandit { namespace Matchers {
+ class Matcher
+ {
+ public:
+ Matcher() {}
+
+ template<typename U>
+ std::string failure_message(const U& value, bool negate) const
+ {
+ std::ostringstream ss;
+ ss << "Expected <" << value << "> " << (negate ? "to not " : "to ") << failure_message_end();
+ return ss.str();
+ }
+
+ std::string failure_message(char *const value, bool negate) const
+ {
+ return failure_message((value ? value : "NULL"), negate);
+ }
+
+ template<typename U>
+ std::string failure_message(const std::unique_ptr<U>& value, bool negate) const
+ {
+ return failure_message(value.get(), negate);
+ }
+
+ std::string failure_message(const std::nullptr_t pointer, bool negate) const
+ {
+ (void)pointer;
+ return failure_message("nullptr", negate);
+ }
+
+ template<typename U>
+ std::string failure_message(std::function<U>& value, bool negate) const
+ {
+ return failure_message(typeid(value).name(), negate);
+ }
+
+ template<typename U>
+ std::string failure_message(const std::function<U>& value, bool negate) const
+ {
+ return failure_message(typeid(value).name(), negate);
+ }
+
+ template<typename U, template <class T, class = std::allocator<T> > class container >
+ std::string failure_message(const container<U>& value, bool negate) const
+ {
+ return failure_message(typeid(value).name(), negate);
+ }
+
+ template<typename U, template <class T, class = std::less<T>, class = std::allocator<T> > class container >
+ std::string failure_message(const container<U>& value, bool negate) const
+ {
+ return failure_message(typeid(value).name(), negate);
+ }
+
+ template<typename U, typename V, template <class K, class T, class = std::less<K>, class = std::allocator<std::pair<const K,T>> > class container >
+ std::string failure_message(const container<U,V>& value, bool negate) const
+ {
+ return failure_message(typeid(value).name(), negate);
+ }
+
+ protected:
+ virtual std::string failure_message_end() const = 0;
+ };
+}}
+
+#endif // BANDIT_MATCHER_H
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/MatcherException.h b/vendor/bandit/bandit/assertion_frameworks/matchers/MatcherException.h
new file mode 100644
index 00000000..5d657ed7
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/MatcherException.h
@@ -0,0 +1,16 @@
+#ifndef BANDIT_MATCHER_EXCEPTION_H
+#define BANDIT_MATCHER_EXCEPTION_H
+
+#include <bandit/assertion_exception.h>
+
+namespace bandit { namespace Matchers {
+ class MatcherException : public detail::assertion_exception
+ {
+ public:
+ MatcherException(const std::string& filename, const unsigned linenumber, const std::string& message) : detail::assertion_exception(message, filename, linenumber) {}
+ MatcherException(const MatcherException&) = default;
+ virtual ~MatcherException() noexcept {}
+ };
+}}
+
+#endif // BANDIT_MATCHER_EXCEPTION_H
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/ThrowException.h b/vendor/bandit/bandit/assertion_frameworks/matchers/ThrowException.h
new file mode 100644
index 00000000..cd8bfc34
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/ThrowException.h
@@ -0,0 +1,60 @@
+#ifndef BANDIT_THROWEXCEPTION_H
+#define BANDIT_THROWEXCEPTION_H
+
+#include "Matcher.h"
+
+namespace bandit { namespace Matchers {
+
+ template <typename T>
+ class ThrowException : public Matcher
+ {
+ public:
+ ThrowException() : Matcher(), _allow_subclasses(false) {}
+ explicit ThrowException(bool allow_subclasses) : Matcher(), _allow_subclasses(allow_subclasses) {}
+
+ template <typename U = std::exception>
+ ThrowException<U> operator()() const
+ {
+ return ThrowException<U>();
+ }
+
+ ThrowException& or_subclass()
+ {
+ _allow_subclasses = true;
+ return *this;
+ }
+
+ template <typename U>
+ bool matches(const U& block) const
+ {
+ try
+ {
+ block();
+ }
+ catch(const T& e)
+ {
+ return true;
+ }
+ catch(...) // Wrong exception
+ {
+ _exception = std::current_exception();
+ }
+
+ return false;
+ }
+
+ protected:
+ std::string failure_message_end() const
+ {
+ return std::string("throw an exception");
+ }
+
+ private:
+ bool _allow_subclasses;
+ mutable std::exception_ptr _exception;
+ };
+
+ static const ThrowException<std::exception> throw_exception;
+}}
+
+#endif // BANDIT_THROWEXCEPTION_H
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/ValueProxy.h b/vendor/bandit/bandit/assertion_frameworks/matchers/ValueProxy.h
new file mode 100644
index 00000000..0cd5d35c
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/ValueProxy.h
@@ -0,0 +1,26 @@
+#ifndef BANDIT_VALUEPROXY_H
+#define BANDIT_VALUEPROXY_H
+
+#include "MatchProxy.h"
+
+namespace bandit { namespace Matchers {
+
+ template<typename T>
+ class ValueProxy
+ {
+ public:
+ MatchProxy<T> to;
+ MatchProxy<T> to_not;
+
+ explicit ValueProxy(const char* filename, int lineNumber, const T& value) : to(*this), to_not(*this, true), _value(value), _filename(filename), _lineNumber(lineNumber) {}
+
+ private:
+ friend class MatchProxy<T>;
+
+ const T& _value;
+ std::string _filename;
+ int _lineNumber;
+ };
+}}
+
+#endif // BANDIT_VALUEPROXY_H
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/matchers.h b/vendor/bandit/bandit/assertion_frameworks/matchers/matchers.h
new file mode 100644
index 00000000..033cefcd
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/matchers.h
@@ -0,0 +1,19 @@
+#ifndef BANDIT_MATCHERS_H
+#define BANDIT_MATCHERS_H
+
+#include "must.h"
+
+#include "BeCloseTo.h"
+#include "BeEmpty.h"
+#include "BeFalsy.h"
+#include "BeGreaterThan.h"
+#include "BeGTE.h"
+#include "BeLessThan.h"
+#include "BeLTE.h"
+#include "BeNull.h"
+#include "BeTruthy.h"
+#include "Contain.h"
+#include "Equal.h"
+#include "ThrowException.h"
+
+#endif // BANDIT_MATCHERS_H
diff --git a/vendor/bandit/bandit/assertion_frameworks/matchers/must.h b/vendor/bandit/bandit/assertion_frameworks/matchers/must.h
new file mode 100644
index 00000000..54eedb7f
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/matchers/must.h
@@ -0,0 +1,36 @@
+#ifndef BANDIT_MUST_H
+#define BANDIT_MUST_H
+
+#include "ValueProxy.h"
+
+namespace bandit { namespace Matchers
+{
+ struct ValueMarker
+ {
+ const char* filename;
+ int lineNumber;
+ };
+
+ template<typename T>
+ const ValueProxy<T> operator,(const T& value, const ValueMarker& marker)
+ {
+ return ValueProxy<T>(marker.filename, marker.lineNumber, value);
+ }
+
+ template<typename T>
+ const MatchProxy<T> operator,(const ValueProxy<T>& value, bool negate)
+ {
+ return negate ? value.to_not : value.to;
+ }
+
+ template<typename T, typename MatcherType>
+ void operator,(const MatchProxy<T>& matchProxy, const MatcherType& matcher)
+ {
+ matchProxy(matcher);
+ }
+}}
+
+#define must ,(bandit::Matchers::ValueMarker){__FILE__, __LINE__},false,
+#define must_not ,(bandit::Matchers::ValueMarker){__FILE__, __LINE__},true,
+
+#endif //BANDIT_MUST_H