1*bb611c8fSApple OSS Distributions //
2*bb611c8fSApple OSS Distributions // Tests for
3*bb611c8fSApple OSS Distributions //  template <typename T, typename P>
4*bb611c8fSApple OSS Distributions //  bool operator==(bounded_array_ref<T, P> const& x, std::nullptr_t);
5*bb611c8fSApple OSS Distributions //
6*bb611c8fSApple OSS Distributions //  template <typename T, typename P>
7*bb611c8fSApple OSS Distributions //  bool operator!=(bounded_array_ref<T, P> const& x, std::nullptr_t);
8*bb611c8fSApple OSS Distributions //
9*bb611c8fSApple OSS Distributions //  template <typename T, typename P>
10*bb611c8fSApple OSS Distributions //  bool operator==(std::nullptr_t, bounded_array_ref<T, P> const& x);
11*bb611c8fSApple OSS Distributions //
12*bb611c8fSApple OSS Distributions //  template <typename T, typename P>
13*bb611c8fSApple OSS Distributions //  bool operator!=(std::nullptr_t, bounded_array_ref<T, P> const& x);
14*bb611c8fSApple OSS Distributions //
15*bb611c8fSApple OSS Distributions 
16*bb611c8fSApple OSS Distributions #include <libkern/c++/bounded_array_ref.h>
17*bb611c8fSApple OSS Distributions #include "test_policy.h"
18*bb611c8fSApple OSS Distributions #include <darwintest.h>
19*bb611c8fSApple OSS Distributions #include <darwintest_utils.h>
20*bb611c8fSApple OSS Distributions 
21*bb611c8fSApple OSS Distributions struct T { int i; };
22*bb611c8fSApple OSS Distributions 
23*bb611c8fSApple OSS Distributions template <typename T>
24*bb611c8fSApple OSS Distributions static void
25*bb611c8fSApple OSS Distributions tests()
26*bb611c8fSApple OSS Distributions {
27*bb611c8fSApple OSS Distributions 	{
28*bb611c8fSApple OSS Distributions 		T array[5] = {T{0}, T{1}, T{2}, T{3}, T{4}};
29*bb611c8fSApple OSS Distributions 		test_bounded_array_ref<T> view(array);
30*bb611c8fSApple OSS Distributions 		CHECK(!(view == nullptr));
31*bb611c8fSApple OSS Distributions 		CHECK(!(nullptr == view));
32*bb611c8fSApple OSS Distributions 		CHECK(view != nullptr);
33*bb611c8fSApple OSS Distributions 		CHECK(nullptr != view);
34*bb611c8fSApple OSS Distributions 	}
35*bb611c8fSApple OSS Distributions 	{
36*bb611c8fSApple OSS Distributions 		test_bounded_array_ref<T> view;
37*bb611c8fSApple OSS Distributions 		CHECK(view == nullptr);
38*bb611c8fSApple OSS Distributions 		CHECK(nullptr == view);
39*bb611c8fSApple OSS Distributions 		CHECK(!(view != nullptr));
40*bb611c8fSApple OSS Distributions 		CHECK(!(nullptr != view));
41*bb611c8fSApple OSS Distributions 	}
42*bb611c8fSApple OSS Distributions }
43*bb611c8fSApple OSS Distributions 
44*bb611c8fSApple OSS Distributions T_DECL(compare_equal_nullptr, "bounded_array_ref.compare.equal.nullptr") {
45*bb611c8fSApple OSS Distributions 	tests<T>();
46*bb611c8fSApple OSS Distributions }
47