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