]> git.saurik.com Git - apple/xnu.git/blame - tests/intrusive_shared_ptr_src/ctor.nullptr.cpp
xnu-7195.101.1.tar.gz
[apple/xnu.git] / tests / intrusive_shared_ptr_src / ctor.nullptr.cpp
CommitLineData
f427ee49
A
1//
2// Tests for
3// intrusive_shared_ptr(nullptr_t);
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
11struct T { int i; };
12
13template <typename T>
14static void
15tests()
16{
17 {
18 libkern::intrusive_shared_ptr<T, test_policy> ptr = nullptr;
19 CHECK(ptr.get() == nullptr);
20 }
21 {
22 libkern::intrusive_shared_ptr<T, test_policy> ptr{nullptr};
23 CHECK(ptr.get() == nullptr);
24 }
25 {
26 libkern::intrusive_shared_ptr<T, test_policy> ptr(nullptr);
27 CHECK(ptr.get() == nullptr);
28 }
29}
30
31T_DECL(ctor_nullptr, "intrusive_shared_ptr.ctor.nullptr") {
32 tests<T>();
33}