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