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