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