// // Tests for // safe_allocation(std::nullptr_t); // #include #include #include "test_utils.h" struct T { int i; }; template static void tests() { { test_safe_allocation array(nullptr); CHECK(array.data() == nullptr); CHECK(array.size() == 0); CHECK(array.begin() == array.end()); } { test_safe_allocation array{nullptr}; CHECK(array.data() == nullptr); CHECK(array.size() == 0); CHECK(array.begin() == array.end()); } { test_safe_allocation array = nullptr; CHECK(array.data() == nullptr); CHECK(array.size() == 0); CHECK(array.begin() == array.end()); } { auto f = [](test_safe_allocation array) { CHECK(array.data() == nullptr); CHECK(array.size() == 0); CHECK(array.begin() == array.end()); }; f(nullptr); } } T_DECL(ctor_nullptr, "safe_allocation.ctor.nullptr", T_META_TAG_VM_PREFERRED) { tests(); tests(); }