summaryrefslogtreecommitdiffstats
path: root/libcxx/test/utilities
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2010-08-19 18:59:38 +0000
committerHoward Hinnant <hhinnant@apple.com>2010-08-19 18:59:38 +0000
commit1102fbbd6772223d4c87b6d3c5ca07fab6125302 (patch)
treed5e0e1593a8af64cf95bbb2d4964cdbcd70d523e /libcxx/test/utilities
parent1cd2472ac2b5fa23d1567847f9313469b9586a02 (diff)
downloadbcm5719-llvm-1102fbbd6772223d4c87b6d3c5ca07fab6125302.tar.gz
bcm5719-llvm-1102fbbd6772223d4c87b6d3c5ca07fab6125302.zip
US 98, US 99
llvm-svn: 111542
Diffstat (limited to 'libcxx/test/utilities')
-rw-r--r--libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp72
-rw-r--r--libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/pack_arguments.pass.cpp21
2 files changed, 72 insertions, 21 deletions
diff --git a/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp b/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp
new file mode 100644
index 00000000000..4ea7d4ed12c
--- /dev/null
+++ b/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <tuple>
+
+// template<class... Types>
+// tuple<Types&&...> forward_as_tuple(Types&&... t);
+
+
+#include <tuple>
+#include <cassert>
+
+template <class Tuple>
+void
+test0(const Tuple& t)
+{
+ static_assert(std::tuple_size<Tuple>::value == 0, "");
+}
+
+template <class Tuple>
+void
+test1a(const Tuple& t)
+{
+ static_assert(std::tuple_size<Tuple>::value == 1, "");
+ static_assert(std::is_same<typename std::tuple_element<0, Tuple>::type, int&&>::value, "");
+ assert(std::get<0>(t) == 1);
+}
+
+template <class Tuple>
+void
+test1b(const Tuple& t)
+{
+ static_assert(std::tuple_size<Tuple>::value == 1, "");
+ static_assert(std::is_same<typename std::tuple_element<0, Tuple>::type, int&>::value, "");
+ assert(std::get<0>(t) == 2);
+}
+
+template <class Tuple>
+void
+test2a(const Tuple& t)
+{
+ static_assert(std::tuple_size<Tuple>::value == 2, "");
+ static_assert(std::is_same<typename std::tuple_element<0, Tuple>::type, double&>::value, "");
+ static_assert(std::is_same<typename std::tuple_element<1, Tuple>::type, char&>::value, "");
+ assert(std::get<0>(t) == 2.5);
+ assert(std::get<1>(t) == 'a');
+}
+
+int main()
+{
+ {
+ test0(std::forward_as_tuple());
+ }
+ {
+ test1a(std::forward_as_tuple(1));
+ }
+ {
+ int i = 2;
+ test1b(std::forward_as_tuple(i));
+ }
+ {
+ double i = 2.5;
+ char c = 'a';
+ test2a(std::forward_as_tuple(i, c));
+ }
+}
diff --git a/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/pack_arguments.pass.cpp b/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/pack_arguments.pass.cpp
deleted file mode 100644
index 6b7f1891a62..00000000000
--- a/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/pack_arguments.pass.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <tuple>
-
-// template<class... Types>
-// tuple<ATypes...> pack_arguments(Types&&... t);
-
-
-#include <tuple>
-
-int main()
-{
-#error pack_arguments not implemented
-}
OpenPOWER on IntegriCloud