summaryrefslogtreecommitdiff
path: root/test/std/experimental/utilities/time/header.chrono.synop
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/experimental/utilities/time/header.chrono.synop')
-rw-r--r--test/std/experimental/utilities/time/header.chrono.synop/includes.pass.cpp19
-rw-r--r--test/std/experimental/utilities/time/header.chrono.synop/treat_as_floating_point_v.pass.cpp49
2 files changed, 68 insertions, 0 deletions
diff --git a/test/std/experimental/utilities/time/header.chrono.synop/includes.pass.cpp b/test/std/experimental/utilities/time/header.chrono.synop/includes.pass.cpp
new file mode 100644
index 0000000000000..f6ad37f9ee3e2
--- /dev/null
+++ b/test/std/experimental/utilities/time/header.chrono.synop/includes.pass.cpp
@@ -0,0 +1,19 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/chrono>
+
+#include <experimental/chrono>
+
+int main()
+{
+ // Check that <chrono> has been included.
+ std::chrono::seconds s;
+ ((void)s);
+}
diff --git a/test/std/experimental/utilities/time/header.chrono.synop/treat_as_floating_point_v.pass.cpp b/test/std/experimental/utilities/time/header.chrono.synop/treat_as_floating_point_v.pass.cpp
new file mode 100644
index 0000000000000..9ac9a2ed1c83b
--- /dev/null
+++ b/test/std/experimental/utilities/time/header.chrono.synop/treat_as_floating_point_v.pass.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// 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: c++98, c++03, c++11
+
+// <experimental/chrono>
+
+// template <class Rep> constexpr bool treat_as_floating_point_v;
+
+#include <experimental/chrono>
+#include <type_traits>
+
+namespace ex = std::chrono::experimental;
+namespace cr = std::chrono;
+
+template <class T, bool Expect>
+void test()
+{
+ static_assert(
+ ex::treat_as_floating_point_v<T> == Expect, ""
+ );
+ static_assert(
+ ex::treat_as_floating_point_v<T> == cr::treat_as_floating_point<T>::value, ""
+ );
+}
+
+int main()
+{
+ {
+ static_assert(
+ std::is_same<
+ decltype(ex::treat_as_floating_point_v<float>), const bool
+ >::value, ""
+ );
+ }
+ test<int, false>();
+ test<unsigned, false>();
+ test<char, false>();
+ test<bool, false>();
+ test<float, true>();
+ test<double, true>();
+ test<long double, true>();
+}