X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/eb6b6ca394357805f2bdba989abae309f718b4d8..f427ee49d309d8fc33ebf3042c3a775f2f530ded:/tests/bounded_array_ref_src/operator.bool.cpp diff --git a/tests/bounded_array_ref_src/operator.bool.cpp b/tests/bounded_array_ref_src/operator.bool.cpp new file mode 100644 index 000000000..bd52b9f58 --- /dev/null +++ b/tests/bounded_array_ref_src/operator.bool.cpp @@ -0,0 +1,38 @@ +// +// Tests for +// explicit operator bool() const; +// + +#include +#include "test_policy.h" +#include +#include + +struct T { int i; }; + +template +static void +tests() +{ + { + test_bounded_array_ref const view; + if (view) { + CHECK(false); + } + CHECK(!view); + } + { + T array[5] = {}; + test_bounded_array_ref const view(array); + if (view) { + } else { + CHECK(false); + } + CHECK(!!view); + } +} + +T_DECL(operator_bool, "bounded_array_ref.operator.bool") { + tests(); + tests(); +}