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