1bb611c8fSApple OSS Distributions //
2bb611c8fSApple OSS Distributions // Tests for
3bb611c8fSApple OSS Distributions //  bounded_array_ref();
4bb611c8fSApple OSS Distributions //
5bb611c8fSApple OSS Distributions 
6bb611c8fSApple OSS Distributions #include <libkern/c++/bounded_array_ref.h>
7bb611c8fSApple OSS Distributions #include "test_policy.h"
8bb611c8fSApple OSS Distributions #include <darwintest.h>
9bb611c8fSApple OSS Distributions #include <darwintest_utils.h>
10bb611c8fSApple OSS Distributions 
11bb611c8fSApple OSS Distributions struct T { int i; };
12bb611c8fSApple OSS Distributions 
13bb611c8fSApple OSS Distributions template <typename T>
14bb611c8fSApple OSS Distributions static void
tests()15bb611c8fSApple OSS Distributions tests()
16bb611c8fSApple OSS Distributions {
17bb611c8fSApple OSS Distributions 	{
18bb611c8fSApple OSS Distributions 		test_bounded_array_ref<T> view;
19bb611c8fSApple OSS Distributions 		CHECK(view.data() == nullptr);
20bb611c8fSApple OSS Distributions 		CHECK(view.size() == 0);
21bb611c8fSApple OSS Distributions 	}
22bb611c8fSApple OSS Distributions 	{
23bb611c8fSApple OSS Distributions 		test_bounded_array_ref<T> view{};
24bb611c8fSApple OSS Distributions 		CHECK(view.data() == nullptr);
25bb611c8fSApple OSS Distributions 		CHECK(view.size() == 0);
26bb611c8fSApple OSS Distributions 	}
27bb611c8fSApple OSS Distributions 	{
28bb611c8fSApple OSS Distributions 		test_bounded_array_ref<T> view = test_bounded_array_ref<T>();
29bb611c8fSApple OSS Distributions 		CHECK(view.data() == nullptr);
30bb611c8fSApple OSS Distributions 		CHECK(view.size() == 0);
31bb611c8fSApple OSS Distributions 	}
32bb611c8fSApple OSS Distributions }
33bb611c8fSApple OSS Distributions 
34*8d741a5dSApple OSS Distributions T_DECL(ctor_default, "bounded_array_ref.ctor.default", T_META_TAG_VM_PREFERRED) {
35bb611c8fSApple OSS Distributions 	tests<T>();
36bb611c8fSApple OSS Distributions 	tests<T const>();
37bb611c8fSApple OSS Distributions }
38