diff options
Diffstat (limited to 'vendor/bandit/specs/matchers/be_null.cpp')
-rw-r--r-- | vendor/bandit/specs/matchers/be_null.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/vendor/bandit/specs/matchers/be_null.cpp b/vendor/bandit/specs/matchers/be_null.cpp new file mode 100644 index 00000000..ae3cd40d --- /dev/null +++ b/vendor/bandit/specs/matchers/be_null.cpp @@ -0,0 +1,43 @@ +#include <specs/specs.h> + +using namespace bandit::Matchers; + +SPEC_BEGIN(Matchers::BeNull) + +describe("be_null matcher", [&]{ + describe("when the value is a pointer to a built-in type", [&]{ + int* value; + + describe("which is NULL", [&]{ + before_each([&]{ + value = NULL; + }); + + it("must pass a positive match", [&]{ + value must be_null; + }); + + it("must reject a negative match", [&]{ + AssertThrows(std::exception, [&]{ value must_not be_null; }()); + }); + }); + + describe("which is not NULL", [&]{ + int i = 7; + + before_each([&]{ + value = &i; + }); + + it("must pass a negative match", [&]{ + value must_not be_null; + }); + + it("must reject a positive match", [&]{ + AssertThrows(std::exception, [&]{ value must be_null; }()); + }); + }); + }); +}); + +SPEC_END |