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