From 61b9a7258a7693d7f3674a5a1daf7b036ff1d382 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 6 Sep 2015 18:46:46 +0000 Subject: Import libc++ 3.7.0 release (r246257). --- .../alg.copy/copy_n.pass.cpp | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 test/std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp (limited to 'test/std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp') diff --git a/test/std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp new file mode 100644 index 0000000000000..1dba8847c7e5f --- /dev/null +++ b/test/std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp @@ -0,0 +1,76 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template OutIter> +// OutIter +// copy_n(InIter first, InIter::difference_type n, OutIter result); + +#include +#include + +#include "test_iterators.h" +#include "user_defined_integral.hpp" + +typedef UserDefinedIntegral UDI; + +template +void +test() +{ + const unsigned N = 1000; + int ia[N]; + for (unsigned i = 0; i < N; ++i) + ia[i] = i; + int ib[N] = {0}; + + OutIter r = std::copy_n(InIter(ia), UDI(N/2), OutIter(ib)); + assert(base(r) == ib+N/2); + for (unsigned i = 0; i < N/2; ++i) + assert(ia[i] == ib[i]); +} + +int main() +{ + test, output_iterator >(); + test, input_iterator >(); + test, forward_iterator >(); + test, bidirectional_iterator >(); + test, random_access_iterator >(); + test, int*>(); + + test, output_iterator >(); + test, input_iterator >(); + test, forward_iterator >(); + test, bidirectional_iterator >(); + test, random_access_iterator >(); + test, int*>(); + + test, output_iterator >(); + test, input_iterator >(); + test, forward_iterator >(); + test, bidirectional_iterator >(); + test, random_access_iterator >(); + test, int*>(); + + test, output_iterator >(); + test, input_iterator >(); + test, forward_iterator >(); + test, bidirectional_iterator >(); + test, random_access_iterator >(); + test, int*>(); + + test >(); + test >(); + test >(); + test >(); + test >(); + test(); +} -- cgit v1.2.3