summaryrefslogtreecommitdiff
path: root/test/libcxx/atomics
diff options
context:
space:
mode:
Diffstat (limited to 'test/libcxx/atomics')
-rw-r--r--test/libcxx/atomics/atomics.flag/init_bool.pass.cpp31
-rw-r--r--test/libcxx/atomics/version.pass.cpp22
2 files changed, 53 insertions, 0 deletions
diff --git a/test/libcxx/atomics/atomics.flag/init_bool.pass.cpp b/test/libcxx/atomics/atomics.flag/init_bool.pass.cpp
new file mode 100644
index 000000000000..d7b172cd1212
--- /dev/null
+++ b/test/libcxx/atomics/atomics.flag/init_bool.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// struct atomic_flag
+
+// TESTING EXTENSION atomic_flag(bool)
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+ {
+ std::atomic_flag f(false);
+ assert(f.test_and_set() == 0);
+ }
+ {
+ std::atomic_flag f(true);
+ assert(f.test_and_set() == 1);
+ }
+}
diff --git a/test/libcxx/atomics/version.pass.cpp b/test/libcxx/atomics/version.pass.cpp
new file mode 100644
index 000000000000..fae2736d229f
--- /dev/null
+++ b/test/libcxx/atomics/version.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+#include <atomic>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}