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