1 // 2 // Tests for 3 // intrusive_shared_ptr(); 4 // 5 6 #include <libkern/c++/intrusive_shared_ptr.h> 7 #include <darwintest.h> 8 #include <darwintest_utils.h> 9 #include "test_policy.h" 10 11 struct T { int i; }; 12 13 template <typename T> 14 static void tests()15tests() 16 { 17 { 18 libkern::intrusive_shared_ptr<T, test_policy> ptr; 19 CHECK(ptr.get() == nullptr); 20 } 21 { 22 libkern::intrusive_shared_ptr<T, test_policy> ptr{}; 23 CHECK(ptr.get() == nullptr); 24 } 25 { 26 libkern::intrusive_shared_ptr<T, test_policy> ptr = libkern::intrusive_shared_ptr<T, test_policy>(); 27 CHECK(ptr.get() == nullptr); 28 } 29 { 30 libkern::intrusive_shared_ptr<T, test_policy> ptr = {}; 31 CHECK(ptr.get() == nullptr); 32 } 33 } 34 35 T_DECL(ctor_default, "intrusive_shared_ptr.ctor.default", T_META_TAG_VM_PREFERRED) { 36 tests<T>(); 37 } 38