#include "testbase.hpp" #include #include "../cxxutil.hpp" namespace { class A { public: virtual bool foo() = 0; }; class B : public A { public: virtual bool foo() override final { return true; }; }; } // namespace TEST_CASE("NotNull is constructible from int*") { int a = 0; REQUIRE(srb2::NotNull(static_cast(&a))); } TEST_CASE("NotNull is constructible from B* where B inherits from A") { B b; REQUIRE(srb2::NotNull(static_cast(&b))); } TEST_CASE("NotNull dereferences to B& to call foo") { B b; srb2::NotNull a {static_cast(&b)}; REQUIRE(a->foo()); }