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