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