From 4f009913dfb014b9ac00ddd23c0c67bc53b1efcf Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 15 Nov 2017 02:31:14 +0000 Subject: [PATCH] More missing tests - array<>::size() and array<>::max_size() git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318256 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../containers/sequences/array/empty.pass.cpp | 36 +++++++++++++++++++ .../sequences/array/max_size.pass.cpp | 36 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 test/std/containers/sequences/array/empty.pass.cpp create mode 100644 test/std/containers/sequences/array/max_size.pass.cpp diff --git a/test/std/containers/sequences/array/empty.pass.cpp b/test/std/containers/sequences/array/empty.pass.cpp new file mode 100644 index 000000000..2c01dfc86 --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// + +// class array + +// bool empty() const noexcept; + +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main() +{ + { + typedef std::array C; + C c; + ASSERT_NOEXCEPT(c.empty()); + assert(!c.empty()); + } + { + typedef std::array C; + C c; + ASSERT_NOEXCEPT(c.empty()); + assert( c.empty()); + } +} diff --git a/test/std/containers/sequences/array/max_size.pass.cpp b/test/std/containers/sequences/array/max_size.pass.cpp new file mode 100644 index 000000000..9a3fed395 --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// + +// class array + +// bool max_size() const noexcept; + +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main() +{ + { + typedef std::array C; + C c; + ASSERT_NOEXCEPT(c.max_size()); + assert(c.max_size() == 2); + } + { + typedef std::array C; + C c; + ASSERT_NOEXCEPT(c.max_size()); + assert(c.max_size() == 0); + } +}