]> git.saurik.com Git - apple/xnu.git/blobdiff - tests/bounded_ptr_src/ctor.default.cpp
xnu-7195.50.7.100.1.tar.gz
[apple/xnu.git] / tests / bounded_ptr_src / ctor.default.cpp
diff --git a/tests/bounded_ptr_src/ctor.default.cpp b/tests/bounded_ptr_src/ctor.default.cpp
new file mode 100644 (file)
index 0000000..392f3b5
--- /dev/null
@@ -0,0 +1,34 @@
+//
+// Tests for
+//  explicit bounded_ptr();
+//
+
+#include <libkern/c++/bounded_ptr.h>
+#include <darwintest.h>
+#include <darwintest_utils.h>
+#include "test_utils.h"
+
+#define _assert(...) T_ASSERT_TRUE((__VA_ARGS__), # __VA_ARGS__)
+
+struct T { };
+
+template <typename T>
+static void
+tests()
+{
+       {
+               test_bounded_ptr<T> p;
+               _assert(p == nullptr);
+       }
+       {
+               test_bounded_ptr<T> p{};
+               _assert(p == nullptr);
+       }
+}
+
+T_DECL(ctor_default, "bounded_ptr.ctor.default") {
+       tests<T>();
+       tests<T const>();
+       tests<T volatile>();
+       tests<T const volatile>();
+}