From 3e519524c118651123eecf60c2bbc5d65ad9bac3 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Tue, 11 May 2010 19:42:16 +0000 Subject: libcxx initial import llvm-svn: 103490 --- .../valarray.binary/and_valarray_value.pass.cpp | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_value.pass.cpp (limited to 'libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_value.pass.cpp') diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_value.pass.cpp new file mode 100644 index 00000000000..82a978f40d7 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_value.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template class valarray; + +// template valarray operator&(const valarray& x, const T& y); + +#include +#include + +int main() +{ + { + typedef int T; + T a1[] = { 1, 2, 3, 4, 5}; + T a2[] = { 1, 2, 3, 0, 1}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray v1(a1, N); + std::valarray v2 = v1 & 3; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} -- cgit v1.2.3