X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/eb6b6ca394357805f2bdba989abae309f718b4d8..f427ee49d309d8fc33ebf3042c3a775f2f530ded:/tests/bounded_array_ref_src/compare.equal.nullptr.cpp diff --git a/tests/bounded_array_ref_src/compare.equal.nullptr.cpp b/tests/bounded_array_ref_src/compare.equal.nullptr.cpp new file mode 100644 index 000000000..700256e69 --- /dev/null +++ b/tests/bounded_array_ref_src/compare.equal.nullptr.cpp @@ -0,0 +1,46 @@ +// +// Tests for +// template +// bool operator==(bounded_array_ref const& x, std::nullptr_t); +// +// template +// bool operator!=(bounded_array_ref const& x, std::nullptr_t); +// +// template +// bool operator==(std::nullptr_t, bounded_array_ref const& x); +// +// template +// bool operator!=(std::nullptr_t, bounded_array_ref const& x); +// + +#include +#include "test_policy.h" +#include +#include + +struct T { int i; }; + +template +static void +tests() +{ + { + T array[5] = {T{0}, T{1}, T{2}, T{3}, T{4}}; + test_bounded_array_ref view(array); + CHECK(!(view == nullptr)); + CHECK(!(nullptr == view)); + CHECK(view != nullptr); + CHECK(nullptr != view); + } + { + test_bounded_array_ref view; + CHECK(view == nullptr); + CHECK(nullptr == view); + CHECK(!(view != nullptr)); + CHECK(!(nullptr != view)); + } +} + +T_DECL(compare_equal_nullptr, "bounded_array_ref.compare.equal.nullptr") { + tests(); +}