xref: /xnu-10002.81.5/tests/bounded_ptr_src/ctor.default.cpp (revision 5e3eaea39dcf651e66cb99ba7d70e32cc4a99587)
1*5e3eaea3SApple OSS Distributions //
2*5e3eaea3SApple OSS Distributions // Tests for
3*5e3eaea3SApple OSS Distributions //  explicit bounded_ptr();
4*5e3eaea3SApple OSS Distributions //
5*5e3eaea3SApple OSS Distributions 
6*5e3eaea3SApple OSS Distributions #include <libkern/c++/bounded_ptr.h>
7*5e3eaea3SApple OSS Distributions #include <darwintest.h>
8*5e3eaea3SApple OSS Distributions #include <darwintest_utils.h>
9*5e3eaea3SApple OSS Distributions #include "test_utils.h"
10*5e3eaea3SApple OSS Distributions 
11*5e3eaea3SApple OSS Distributions #define _assert(...) T_ASSERT_TRUE((__VA_ARGS__), # __VA_ARGS__)
12*5e3eaea3SApple OSS Distributions 
13*5e3eaea3SApple OSS Distributions struct T { };
14*5e3eaea3SApple OSS Distributions 
15*5e3eaea3SApple OSS Distributions template <typename T>
16*5e3eaea3SApple OSS Distributions static void
tests()17*5e3eaea3SApple OSS Distributions tests()
18*5e3eaea3SApple OSS Distributions {
19*5e3eaea3SApple OSS Distributions 	{
20*5e3eaea3SApple OSS Distributions 		test_bounded_ptr<T> p;
21*5e3eaea3SApple OSS Distributions 		_assert(p == nullptr);
22*5e3eaea3SApple OSS Distributions 	}
23*5e3eaea3SApple OSS Distributions 	{
24*5e3eaea3SApple OSS Distributions 		test_bounded_ptr<T> p{};
25*5e3eaea3SApple OSS Distributions 		_assert(p == nullptr);
26*5e3eaea3SApple OSS Distributions 	}
27*5e3eaea3SApple OSS Distributions }
28*5e3eaea3SApple OSS Distributions 
29*5e3eaea3SApple OSS Distributions T_DECL(ctor_default, "bounded_ptr.ctor.default") {
30*5e3eaea3SApple OSS Distributions 	tests<T>();
31*5e3eaea3SApple OSS Distributions 	tests<T const>();
32*5e3eaea3SApple OSS Distributions 	tests<T volatile>();
33*5e3eaea3SApple OSS Distributions 	tests<T const volatile>();
34*5e3eaea3SApple OSS Distributions }
35