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/specs/matchers/be_null.cpp | |
parent | c6196b25d119a10e79deedef26a73e0d5a021b0e (diff) |
Bandit 2.0.0
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 |