summaryrefslogtreecommitdiff
path: root/test/std/containers/sequences/array/array.cons
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/containers/sequences/array/array.cons')
-rw-r--r--test/std/containers/sequences/array/array.cons/default.pass.cpp31
-rw-r--r--test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp34
2 files changed, 65 insertions, 0 deletions
diff --git a/test/std/containers/sequences/array/array.cons/default.pass.cpp b/test/std/containers/sequences/array/array.cons/default.pass.cpp
new file mode 100644
index 0000000000000..7bc62b759c356
--- /dev/null
+++ b/test/std/containers/sequences/array/array.cons/default.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// array();
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ C c;
+ assert(c.size() == 3);
+ }
+ {
+ typedef double T;
+ typedef std::array<T, 0> C;
+ C c;
+ assert(c.size() == 0);
+ }
+}
diff --git a/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp b/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp
new file mode 100644
index 0000000000000..b9775eef0673d
--- /dev/null
+++ b/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// Construct with initizializer list
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ C c = {1, 2, 3.5};
+ assert(c.size() == 3);
+ assert(c[0] == 1);
+ assert(c[1] == 2);
+ assert(c[2] == 3.5);
+ }
+ {
+ typedef double T;
+ typedef std::array<T, 0> C;
+ C c = {};
+ assert(c.size() == 0);
+ }
+}