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