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