]>
git.saurik.com Git - apple/xnu.git/blob - tests/intrusive_shared_ptr_src/ctor.ptr.retain.cpp
3 // explicit intrusive_shared_ptr(pointer p, retain_t);
6 #include <libkern/c++/intrusive_shared_ptr.h>
7 #include <darwintest.h>
8 #include <darwintest_utils.h>
9 #include "test_policy.h"
13 template <typename T
, typename TQual
>
20 test_policy::retain_count
= 0;
21 libkern::intrusive_shared_ptr
<TQual
, test_policy
> ptr(&obj
, libkern::retain
);
22 CHECK(ptr
.get() == &obj
);
23 CHECK(test_policy::retain_count
== 1);
26 test_policy::retain_count
= 0;
27 libkern::intrusive_shared_ptr
<TQual
, test_policy
> ptr
{&obj
, libkern::retain
};
28 CHECK(ptr
.get() == &obj
);
29 CHECK(test_policy::retain_count
== 1);
33 T_DECL(ctor_ptr_retain
, "intrusive_shared_ptr.ctor.ptr.retain") {