Loading...
tests/bounded_array_ref_src/operator.bool.cpp /dev/null xnu-10002.41.9
--- /dev/null
+++ xnu/xnu-10002.41.9/tests/bounded_array_ref_src/operator.bool.cpp
@@ -0,0 +1,38 @@
+//
+// Tests for
+//  explicit operator bool() const;
+//
+
+#include <libkern/c++/bounded_array_ref.h>
+#include "test_policy.h"
+#include <darwintest.h>
+#include <darwintest_utils.h>
+
+struct T { int i; };
+
+template <typename T>
+static void
+tests()
+{
+	{
+		test_bounded_array_ref<T> const view;
+		if (view) {
+			CHECK(false);
+		}
+		CHECK(!view);
+	}
+	{
+		T array[5] = {};
+		test_bounded_array_ref<T> const view(array);
+		if (view) {
+		} else {
+			CHECK(false);
+		}
+		CHECK(!!view);
+	}
+}
+
+T_DECL(operator_bool, "bounded_array_ref.operator.bool") {
+	tests<T>();
+	tests<T const>();
+}