Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2017-11-15 05:31:14 +0300
committerMarshall Clow <mclow.lists@gmail.com>2017-11-15 05:31:14 +0300
commitfc6cc70018cd342b4764ae9df146f27ace35301c (patch)
tree80cdc76002f4067ddb4a9afbfa26a826b59d202a /libcxx/test/std
parent6be7e289b2962eb4bee90ceeb1ea628781b19be9 (diff)
More missing tests - array<>::size() and array<>::max_size()
llvm-svn: 318256
Diffstat (limited to 'libcxx/test/std')
-rw-r--r--libcxx/test/std/containers/sequences/array/empty.pass.cpp36
-rw-r--r--libcxx/test/std/containers/sequences/array/max_size.pass.cpp36
2 files changed, 72 insertions, 0 deletions
diff --git a/libcxx/test/std/containers/sequences/array/empty.pass.cpp b/libcxx/test/std/containers/sequences/array/empty.pass.cpp
new file mode 100644
index 000000000000..2c01dfc86c19
--- /dev/null
+++ b/libcxx/test/std/containers/sequences/array/empty.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// class array
+
+// bool empty() const noexcept;
+
+#include <array>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::array<int, 2> C;
+ C c;
+ ASSERT_NOEXCEPT(c.empty());
+ assert(!c.empty());
+ }
+ {
+ typedef std::array<int, 0> C;
+ C c;
+ ASSERT_NOEXCEPT(c.empty());
+ assert( c.empty());
+ }
+}
diff --git a/libcxx/test/std/containers/sequences/array/max_size.pass.cpp b/libcxx/test/std/containers/sequences/array/max_size.pass.cpp
new file mode 100644
index 000000000000..9a3fed3950e3
--- /dev/null
+++ b/libcxx/test/std/containers/sequences/array/max_size.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// class array
+
+// bool max_size() const noexcept;
+
+#include <array>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::array<int, 2> C;
+ C c;
+ ASSERT_NOEXCEPT(c.max_size());
+ assert(c.max_size() == 2);
+ }
+ {
+ typedef std::array<int, 0> C;
+ C c;
+ ASSERT_NOEXCEPT(c.max_size());
+ assert(c.max_size() == 0);
+ }
+}