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