From 5a83710e371fe68a06e6e3876c6a2c8b820a8976 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 20 Dec 2014 01:40:03 +0000 Subject: Move test into test/std subdirectory. llvm-svn: 224658 --- .../sequences/array/array.swap/swap.pass.cpp | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp (limited to 'libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp') diff --git a/libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp b/libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp new file mode 100644 index 00000000000..c7a4cb8df38 --- /dev/null +++ b/libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// void swap(array& a); + +#include +#include + +int main() +{ + { + typedef double T; + typedef std::array C; + C c1 = {1, 2, 3.5}; + C c2 = {4, 5, 6.5}; + c1.swap(c2); + assert(c1.size() == 3); + assert(c1[0] == 4); + assert(c1[1] == 5); + assert(c1[2] == 6.5); + assert(c2.size() == 3); + assert(c2[0] == 1); + assert(c2[1] == 2); + assert(c2[2] == 3.5); + } + { + typedef double T; + typedef std::array C; + C c1 = {}; + C c2 = {}; + c1.swap(c2); + assert(c1.size() == 0); + assert(c2.size() == 0); + } +} -- cgit v1.2.3