diff options
author | Howard Hinnant <hhinnant@apple.com> | 2010-05-11 19:42:16 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2010-05-11 19:42:16 +0000 |
commit | 3e519524c118651123eecf60c2bbc5d65ad9bac3 (patch) | |
tree | b2dd4168cfe448920a602cd7d2e40f95da187153 /libcxx/test/numerics/numarray/valarray.nonmembers | |
parent | 9132c59d43b6c590c9bb33496eebf9f192d6857a (diff) | |
download | bcm5719-llvm-3e519524c118651123eecf60c2bbc5d65ad9bac3.tar.gz bcm5719-llvm-3e519524c118651123eecf60c2bbc5d65ad9bac3.zip |
libcxx initial import
llvm-svn: 103490
Diffstat (limited to 'libcxx/test/numerics/numarray/valarray.nonmembers')
76 files changed, 2984 insertions, 0 deletions
diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/nothing_to_do.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/nothing_to_do.pass.cpp new file mode 100644 index 00000000000..fa4d462f18d --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/nothing_to_do.pass.cpp @@ -0,0 +1,12 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +int main() +{ +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..d96dd1795d0 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_valarray.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator&(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 5}; + T a2[] = {6, 7, 8, 9, 10}; + T a3[] = {0, 2, 0, 0, 0}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<T> v3 = v1 & v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} 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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator&(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +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<T> v1(a1, N); + std::valarray<T> v2 = v1 & 3; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/and_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/and_value_valarray.pass.cpp new file mode 100644 index 00000000000..e179b2139b2 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/and_value_valarray.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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator&(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +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<T> v1(a1, N); + std::valarray<T> v2 = 3 & v1; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/divide_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/divide_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..e2fdc6fea9a --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/divide_valarray_valarray.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator/(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {6, 14, 24, 36, 50}; + T a2[] = {6, 7, 8, 9, 10}; + T a3[] = {1, 2, 3, 4, 5}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<T> v3 = v1 / v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/divide_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/divide_valarray_value.pass.cpp new file mode 100644 index 00000000000..eaf2093ead8 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/divide_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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator/(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {6, 12, 18, 24, 30}; + T a2[] = {1, 2, 3, 4, 5}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = v1 / 6; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/divide_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/divide_value_valarray.pass.cpp new file mode 100644 index 00000000000..6b1a7c0a3df --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/divide_value_valarray.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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator/(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 5}; + T a2[] = {3, 1, 1, 0, 0}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = 3 / v1; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/minus_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/minus_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..9b5db5f019d --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/minus_valarray_valarray.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator-(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {7, 9, 11, 13, 15}; + T a2[] = {6, 7, 8, 9, 10}; + T a3[] = {1, 2, 3, 4, 5}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<T> v3 = v1 - v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/minus_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/minus_valarray_value.pass.cpp new file mode 100644 index 00000000000..abd6987b922 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/minus_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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator-(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = { 1, 2, 3, 4, 5}; + T a2[] = {-2, -1, 0, 1, 2}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = v1 - 3; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/minus_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/minus_value_valarray.pass.cpp new file mode 100644 index 00000000000..54facf28d71 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/minus_value_valarray.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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator-(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = { 1, 2, 3, 4, 5}; + T a2[] = { 2, 1, 0, -1, -2}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = 3 - v1; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..9ee679d916a --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_valarray_valarray.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator%(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {6, 7, 8, 9, 10}; + T a2[] = {1, 2, 3, 4, 5}; + T a3[] = {0, 1, 2, 1, 0}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<T> v3 = v1 % v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_valarray_value.pass.cpp new file mode 100644 index 00000000000..a3ba746dcaf --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator%(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 5}; + T a2[] = {1, 2, 0, 1, 2}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = v1 % 3; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_value_valarray.pass.cpp new file mode 100644 index 00000000000..5df530d3785 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_value_valarray.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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator%(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 5}; + T a2[] = {0, 1, 0, 3, 3}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = 3 % v1; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/or_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/or_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..c4dc00a528f --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/or_valarray_valarray.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator|(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 5}; + T a2[] = {6, 7, 8, 9, 10}; + T a3[] = {7, 7, 11, 13, 15}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<T> v3 = v1 | v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/or_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/or_valarray_value.pass.cpp new file mode 100644 index 00000000000..a8dc9f08d53 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/or_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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator|(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = { 1, 2, 3, 4, 5}; + T a2[] = { 3, 3, 3, 7, 7}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = v1 | 3; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/or_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/or_value_valarray.pass.cpp new file mode 100644 index 00000000000..01247722306 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/or_value_valarray.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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator|(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = { 1, 2, 3, 4, 5}; + T a2[] = { 3, 3, 3, 7, 7}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = 3 | v1; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/plus_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/plus_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..833f4b00ab6 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/plus_valarray_valarray.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator+(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 5}; + T a2[] = {6, 7, 8, 9, 10}; + T a3[] = {7, 9, 11, 13, 15}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<T> v3 = v1 + v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/plus_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/plus_valarray_value.pass.cpp new file mode 100644 index 00000000000..034963c9bc4 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/plus_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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator+(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 5}; + T a2[] = {4, 5, 6, 7, 8}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = v1 + 3; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/plus_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/plus_value_valarray.pass.cpp new file mode 100644 index 00000000000..e2dd9708c74 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/plus_value_valarray.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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator+(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 5}; + T a2[] = {4, 5, 6, 7, 8}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = 3 + v1; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..5a048bf6478 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_valarray_valarray.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator<<(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = { 1, 2, 3, 4, 5}; + T a2[] = { 6, 7, 8, 9, 10}; + T a3[] = {64, 256, 768, 2048, 5120}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<T> v3 = v1 << v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_valarray_value.pass.cpp new file mode 100644 index 00000000000..e4635e94d6f --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator<<(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = { 1, 2, 3, 4, 5}; + T a2[] = { 8, 16, 24, 32, 40}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = v1 << 3; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_value_valarray.pass.cpp new file mode 100644 index 00000000000..b7aad3d142c --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_value_valarray.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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator<<(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = { 1, 2, 3, 4, 5}; + T a2[] = { 6, 12, 24, 48, 96}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = 3 << v1; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..9daccbc01a5 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_valarray_valarray.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator>>(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {64, 256, 768, 2048, 5120}; + T a2[] = { 6, 7, 8, 9, 10}; + T a3[] = { 1, 2, 3, 4, 5}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<T> v3 = v1 >> v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_valarray_value.pass.cpp new file mode 100644 index 00000000000..3ce786897d4 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator>>(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = { 8, 16, 24, 32, 40}; + T a2[] = { 1, 2, 3, 4, 5}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = v1 >> 3; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_value_valarray.pass.cpp new file mode 100644 index 00000000000..ddf201b97d7 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_value_valarray.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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator>>(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = { 1, 2, 3, 4, 5}; + T a2[] = {20, 10, 5, 2, 1}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = 40 >> v1; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/times_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/times_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..7b6addd6a6e --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/times_valarray_valarray.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator*(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 5}; + T a2[] = {6, 7, 8, 9, 10}; + T a3[] = {6, 14, 24, 36, 50}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<T> v3 = v1 * v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/times_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/times_valarray_value.pass.cpp new file mode 100644 index 00000000000..966916c1f79 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/times_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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator+(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 5}; + T a2[] = {6, 12, 18, 24, 30}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = v1 * 6; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/times_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/times_value_valarray.pass.cpp new file mode 100644 index 00000000000..cafb3043790 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/times_value_valarray.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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator*(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 5}; + T a2[] = {6, 12, 18, 24, 30}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = 6 * v1; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/xor_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/xor_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..d2185763b48 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/xor_valarray_valarray.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator^(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 5}; + T a2[] = {6, 7, 8, 9, 10}; + T a3[] = {7, 5, 11, 13, 15}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<T> v3 = v1 ^ v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/xor_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/xor_valarray_value.pass.cpp new file mode 100644 index 00000000000..99321b055a4 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/xor_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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator^(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = { 1, 2, 3, 4, 5}; + T a2[] = { 2, 1, 0, 7, 6}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = v1 ^ 3; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/xor_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/xor_value_valarray.pass.cpp new file mode 100644 index 00000000000..35126a2e85b --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.binary/xor_value_valarray.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. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> valarray<T> operator^(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = { 1, 2, 3, 4, 5}; + T a2[] = { 2, 1, 0, 7, 6}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2 = 3 ^ v1; + assert(v1.size() == v2.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == a2[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..9a2451207ae --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator&&(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 0}; + T a2[] = {6, 7, 0, 9, 10}; + bool a3[] = {true, true, false, true, false}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = v1 && v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_value.pass.cpp new file mode 100644 index 00000000000..bc8f5d2bfb5 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_value.pass.cpp @@ -0,0 +1,45 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator&&(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 0}; + bool a3[] = {true, true, true, true, false}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<bool> v3 = v1 && 5; + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } + { + typedef int T; + T a1[] = {1, 2, 3, 4, 0}; + bool a3[] = {false, false, false, false, false}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<bool> v3 = v1 && 0; + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/and_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/and_value_valarray.pass.cpp new file mode 100644 index 00000000000..8b02ec29ea0 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/and_value_valarray.pass.cpp @@ -0,0 +1,45 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator&&(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a2[] = {1, 2, 3, 4, 0}; + bool a3[] = {true, true, true, true, false}; + const unsigned N = sizeof(a2)/sizeof(a2[0]); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = 5 && v2; + assert(v2.size() == v3.size()); + for (int i = 0; i < v3.size(); ++i) + assert(v3[i] == a3[i]); + } + { + typedef int T; + T a2[] = {1, 2, 3, 4, 0}; + bool a3[] = {false, false, false, false, false}; + const unsigned N = sizeof(a2)/sizeof(a2[0]); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = 0 && v2; + assert(v2.size() == v3.size()); + for (int i = 0; i < v3.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..4ac72158a72 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator==(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 0, 4, 10}; + T a2[] = {6, 7, 0, 9, 10}; + bool a3[] = {false, false, true, false, true}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = v1 == v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_value.pass.cpp new file mode 100644 index 00000000000..e71ce246455 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_value.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator==(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 0}; + bool a3[] = {false, true, false, false, false}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<bool> v3 = v1 == 2; + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_value_valarray.pass.cpp new file mode 100644 index 00000000000..33c1680956d --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_value_valarray.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator==(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a2[] = {1, 2, 3, 4, 0}; + bool a3[] = {false, true, false, false, false}; + const unsigned N = sizeof(a2)/sizeof(a2[0]); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = 2 == v2; + assert(v2.size() == v3.size()); + for (int i = 0; i < v3.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..5b23ccf8b8b --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator>=(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 0, 4, 10}; + T a2[] = {6, 7, 0, 2, 1}; + bool a3[] = {false, false, true, true, true}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = v1 >= v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_value.pass.cpp new file mode 100644 index 00000000000..daba8aa345f --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_value.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator>=(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 0}; + bool a3[] = {false, true, true, true, false}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<bool> v3 = v1 >= 2; + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_value_valarray.pass.cpp new file mode 100644 index 00000000000..4804c5fde05 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_value_valarray.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator>=(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a2[] = {1, 2, 3, 4, 0}; + bool a3[] = {true, true, false, false, true}; + const unsigned N = sizeof(a2)/sizeof(a2[0]); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = 2 >= v2; + assert(v2.size() == v3.size()); + for (int i = 0; i < v3.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..57f9014b480 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator>(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 0, 4, 10}; + T a2[] = {6, 7, 0, 2, 1}; + bool a3[] = {false, false, false, true, true}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = v1 > v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_value.pass.cpp new file mode 100644 index 00000000000..91ef3e98cdf --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_value.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator>(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 0}; + bool a3[] = {false, false, true, true, false}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<bool> v3 = v1 > 2; + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_value_valarray.pass.cpp new file mode 100644 index 00000000000..c03bc96274a --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_value_valarray.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator>(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a2[] = {1, 2, 3, 4, 0}; + bool a3[] = {true, false, false, false, true}; + const unsigned N = sizeof(a2)/sizeof(a2[0]); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = 2 > v2; + assert(v2.size() == v3.size()); + for (int i = 0; i < v3.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..dd3ca9de091 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator<=(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 0, 4, 10}; + T a2[] = {6, 7, 0, 2, 1}; + bool a3[] = {true, true, true, false, false}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = v1 <= v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_value.pass.cpp new file mode 100644 index 00000000000..919765e0c22 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_value.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator<=(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 0}; + bool a3[] = {true, true, false, false, true}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<bool> v3 = v1 <= 2; + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_value_valarray.pass.cpp new file mode 100644 index 00000000000..2ad6d7ac4fd --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_value_valarray.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator<=(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a2[] = {1, 2, 3, 4, 0}; + bool a3[] = {false, true, true, true, false}; + const unsigned N = sizeof(a2)/sizeof(a2[0]); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = 2 <= v2; + assert(v2.size() == v3.size()); + for (int i = 0; i < v3.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..ea476e4e5d5 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator<(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 0, 4, 10}; + T a2[] = {6, 7, 0, 2, 1}; + bool a3[] = {true, true, false, false, false}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = v1 < v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_value.pass.cpp new file mode 100644 index 00000000000..0f45c4d1823 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_value.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator<(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 0}; + bool a3[] = {true, false, false, false, true}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<bool> v3 = v1 < 2; + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_value_valarray.pass.cpp new file mode 100644 index 00000000000..e80ba4e7535 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/less_value_valarray.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator<(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a2[] = {1, 2, 3, 4, 0}; + bool a3[] = {false, false, true, true, false}; + const unsigned N = sizeof(a2)/sizeof(a2[0]); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = 2 < v2; + assert(v2.size() == v3.size()); + for (int i = 0; i < v3.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..3bdfefec3d4 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator!=(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 0, 4, 10}; + T a2[] = {6, 7, 0, 9, 10}; + bool a3[] = {true, true, false, true, false}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = v1 != v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_value.pass.cpp new file mode 100644 index 00000000000..73afabc5320 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_value.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator!=(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 0}; + bool a3[] = {true, false, true, true, true}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<bool> v3 = v1 != 2; + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_value_valarray.pass.cpp new file mode 100644 index 00000000000..50c50bb9063 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_value_valarray.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator!=(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a2[] = {1, 2, 3, 4, 0}; + bool a3[] = {true, false, true, true, true}; + const unsigned N = sizeof(a2)/sizeof(a2[0]); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = 2 != v2; + assert(v2.size() == v3.size()); + for (int i = 0; i < v3.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..2c9cfb1e567 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator||(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 0, 4, 0}; + T a2[] = {6, 7, 0, 9, 10}; + bool a3[] = {true, true, false, true, true}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = v1 || v2; + assert(v1.size() == v2.size()); + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_value.pass.cpp new file mode 100644 index 00000000000..a7e404cec0c --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_value.pass.cpp @@ -0,0 +1,45 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator||(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 0}; + bool a3[] = {true, true, true, true, true}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<bool> v3 = v1 || 5; + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } + { + typedef int T; + T a1[] = {1, 2, 3, 4, 0}; + bool a3[] = {true, true, true, true, false}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<bool> v3 = v1 || 0; + assert(v1.size() == v3.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/or_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/or_value_valarray.pass.cpp new file mode 100644 index 00000000000..a2c4d44bdd6 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.comparison/or_value_valarray.pass.cpp @@ -0,0 +1,45 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<bool> +// operator||(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a2[] = {1, 2, 3, 4, 0}; + bool a3[] = {true, true, true, true, true}; + const unsigned N = sizeof(a2)/sizeof(a2[0]); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = 5 || v2; + assert(v2.size() == v3.size()); + for (int i = 0; i < v3.size(); ++i) + assert(v3[i] == a3[i]); + } + { + typedef int T; + T a2[] = {1, 2, 3, 4, 0}; + bool a3[] = {true, true, true, true, false}; + const unsigned N = sizeof(a2)/sizeof(a2[0]); + std::valarray<T> v2(a2, N); + std::valarray<bool> v3 = 0 || v2; + assert(v2.size() == v3.size()); + for (int i = 0; i < v3.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.special/swap.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.special/swap.pass.cpp new file mode 100644 index 00000000000..5f89f81a10f --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.special/swap.pass.cpp @@ -0,0 +1,91 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// void +// swap(valarray<T>& x, valarray<T>& y); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef int T; + T a1[] = {1, 2, 3, 4, 5}; + T a2[] = {6, 7, 8, 9, 10, 11, 12}; + const unsigned N1 = sizeof(a1)/sizeof(a1[0]); + const unsigned N2 = sizeof(a2)/sizeof(a2[0]); + std::valarray<T> v1(a1, N1); + std::valarray<T> v2(a2, N2); + std::valarray<T> v1_save = v1; + std::valarray<T> v2_save = v2; + swap(v1, v2); + assert(v1.size() == v2_save.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v1[i] == v2_save[i]); + assert(v2.size() == v1_save.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == v1_save[i]); + } + { + typedef int T; + T a1[] = {1, 2, 3, 4, 5}; + const unsigned N1 = sizeof(a1)/sizeof(a1[0]); + const unsigned N2 = 0; + std::valarray<T> v1(a1, N1); + std::valarray<T> v2; + std::valarray<T> v1_save = v1; + std::valarray<T> v2_save = v2; + swap(v1, v2); + assert(v1.size() == v2_save.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v1[i] == v2_save[i]); + assert(v2.size() == v1_save.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == v1_save[i]); + } + { + typedef int T; + T a2[] = {6, 7, 8, 9, 10, 11, 12}; + const unsigned N1 = 0; + const unsigned N2 = sizeof(a2)/sizeof(a2[0]); + std::valarray<T> v1; + std::valarray<T> v2(a2, N2); + std::valarray<T> v1_save = v1; + std::valarray<T> v2_save = v2; + swap(v1, v2); + assert(v1.size() == v2_save.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v1[i] == v2_save[i]); + assert(v2.size() == v1_save.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == v1_save[i]); + } + { + typedef int T; + const unsigned N1 = 0; + const unsigned N2 = 0; + std::valarray<T> v1; + std::valarray<T> v2; + std::valarray<T> v1_save = v1; + std::valarray<T> v2_save = v2; + swap(v1, v2); + assert(v1.size() == v2_save.size()); + for (int i = 0; i < v1.size(); ++i) + assert(v1[i] == v2_save[i]); + assert(v2.size() == v1_save.size()); + for (int i = 0; i < v2.size(); ++i) + assert(v2[i] == v1_save[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/abs_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/abs_valarray.pass.cpp new file mode 100644 index 00000000000..ff703541987 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/abs_valarray.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// abs(const valarray<T>& x); + +#include <valarray> +#include <cassert> + +int main() +{ + { + typedef double T; + T a1[] = {1.5, -2.5, 3.4, -4.5, -5.0}; + T a3[] = {1.5, 2.5, 3.4, 4.5, 5.0}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = abs(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(v3[i] == a3[i]); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/acos_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/acos_valarray.pass.cpp new file mode 100644 index 00000000000..248bb301133 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/acos_valarray.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// acos(const valarray<T>& x); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {2.6905658417935308e+00, + 2.0943951023931957e+00, + 1.5707963267948966e+00, + 1.0471975511965976e+00, + 7.2273424781341566e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = acos(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/asin_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/asin_valarray.pass.cpp new file mode 100644 index 00000000000..805c38dddb5 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/asin_valarray.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// asin(const valarray<T>& x); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {-1.1197695149986342e+00, + -5.2359877559829882e-01, + 0.0000000000000000e+00, + 5.2359877559829882e-01, + 8.4806207898148100e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = asin(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..cf8b6cd35ef --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_valarray.pass.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// atan2(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a2[] = {-.8, .25, 0.375, -.5, .75}; + T a3[] = {-2.2974386674766221e+00, + -1.1071487177940904e+00, + 0.0000000000000000e+00, + 2.3561944901923448e+00, + 7.8539816339744828e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<T> v3 = atan2(v1, v2); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_value.pass.cpp new file mode 100644 index 00000000000..45257f4f4ee --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_value.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// atan2(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {-8.7605805059819342e-01, + -5.8800260354756750e-01, + 0.0000000000000000e+00, + 5.8800260354756750e-01, + 7.8539816339744828e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = atan2(v1, .75); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_value_valarray.pass.cpp new file mode 100644 index 00000000000..214ec7f9187 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_value_valarray.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// atan2(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {2.4468543773930902e+00, + 2.1587989303424640e+00, + 1.5707963267948966e+00, + 9.8279372324732905e-01, + 7.8539816339744828e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = atan2(.75, v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/atan_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/atan_valarray.pass.cpp new file mode 100644 index 00000000000..84a9bc35431 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/atan_valarray.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// atan(const valarray<T>& x); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {-7.3281510178650666e-01, + -4.6364760900080615e-01, + 0.0000000000000000e+00, + 4.6364760900080615e-01, + 6.4350110879328437e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = atan(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/cos_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/cos_valarray.pass.cpp new file mode 100644 index 00000000000..86e2b33b6d1 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/cos_valarray.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// cos(const valarray<T>& x); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {6.2160996827066450e-01, + 8.7758256189037276e-01, + 1.0000000000000000e+00, + 8.7758256189037276e-01, + 7.3168886887382090e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = cos(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/cosh_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/cosh_valarray.pass.cpp new file mode 100644 index 00000000000..dc0ab154614 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/cosh_valarray.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// cosh(const valarray<T>& x); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {1.4330863854487743e+00, + 1.1276259652063807e+00, + 1.0000000000000000e+00, + 1.1276259652063807e+00, + 1.2946832846768448e+00}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = cosh(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/exp_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/exp_valarray.pass.cpp new file mode 100644 index 00000000000..10f0e980676 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/exp_valarray.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// exp(const valarray<T>& x); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {4.0656965974059911e-01, + 6.0653065971263342e-01, + 1.0000000000000000e+00, + 1.6487212707001282e+00, + 2.1170000166126748e+00}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = exp(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/log10_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/log10_valarray.pass.cpp new file mode 100644 index 00000000000..68491ef99a4 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/log10_valarray.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// log10(const valarray<T>& x); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {.5, .75, 1, 3, 7}; + T a3[] = {-3.0102999566398120e-01, + -1.2493873660829995e-01, + 0.0000000000000000e+00, + 4.7712125471966244e-01, + 8.4509804001425681e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = log10(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/log_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/log_valarray.pass.cpp new file mode 100644 index 00000000000..e79d2164bd8 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/log_valarray.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// log(const valarray<T>& x); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {.5, .75, 1, 3, 7}; + T a3[] = {-6.9314718055994529e-01, + -2.8768207245178090e-01, + 0.0000000000000000e+00, + 1.0986122886681098e+00, + 1.9459101490553132e+00}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = log(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..2969a4849d3 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_valarray.pass.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// pow(const valarray<T>& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {.9, .5, 0., .5, .75}; + T a2[] = {-.8, .25, 0.375, -.5, .75}; + T a3[] = {1.0879426248455297e+00, + 8.4089641525371450e-01, + 0.0000000000000000e+00, + 1.4142135623730949e+00, + 8.0592744886765644e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v2(a2, N); + std::valarray<T> v3 = pow(v1, v2); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_value.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_value.pass.cpp new file mode 100644 index 00000000000..f8a3bbfdc27 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_value.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// pow(const valarray<T>& x, const T& y); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {.9, .5, 0., .5, .75}; + T a3[] = {8.1000000000000005e-01, + 2.5000000000000000e-01, + 0.0000000000000000e+00, + 2.5000000000000000e-01, + 5.6250000000000000e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = pow(v1, 2.0); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_value_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_value_valarray.pass.cpp new file mode 100644 index 00000000000..a32134c30f0 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_value_valarray.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// pow(const T& x, const valarray<T>& y); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {.9, .5, 0., .5, .75}; + T a3[] = {1.8660659830736148e+00, + 1.4142135623730951e+00, + 1.0000000000000000e+00, + 1.4142135623730951e+00, + 1.6817928305074290e+00}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = pow(2.0, v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/sin_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/sin_valarray.pass.cpp new file mode 100644 index 00000000000..8a5df20d936 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/sin_valarray.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// sin(const valarray<T>& x); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {-7.8332690962748330e-01, + -4.7942553860420301e-01, + 0.0000000000000000e+00, + 4.7942553860420301e-01, + 6.8163876002333423e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = sin(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/sinh_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/sinh_valarray.pass.cpp new file mode 100644 index 00000000000..e5da9afbea0 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/sinh_valarray.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// sinh(const valarray<T>& x); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {-1.0265167257081753e+00, + -5.2109530549374738e-01, + 0.0000000000000000e+00, + 5.2109530549374738e-01, + 8.2231673193582999e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = sinh(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/sqrt_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/sqrt_valarray.pass.cpp new file mode 100644 index 00000000000..97fe6d21ed9 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/sqrt_valarray.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// sqrt(const valarray<T>& x); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {.5, .75, 1, 3, 7}; + T a3[] = {7.0710678118654757e-01, + 8.6602540378443860e-01, + 1.0000000000000000e+00, + 1.7320508075688772e+00, + 2.6457513110645907e+00}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = sqrt(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp new file mode 100644 index 00000000000..d1fdb7a5ee6 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// tan(const valarray<T>& x); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {-1.2601582175503390e+00, + -5.4630248984379048e-01, + 0.0000000000000000e+00, + 5.4630248984379048e-01, + 9.3159645994407259e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = tan(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} diff --git a/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp new file mode 100644 index 00000000000..03e5d51e1b4 --- /dev/null +++ b/libcxx/test/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <valarray> + +// template<class T> class valarray; + +// template<class T> +// valarray<T> +// tanh(const valarray<T>& x); + +#include <valarray> +#include <cassert> +#include <sstream> + +bool is_about(double x, double y, int p) +{ + std::ostringstream o; + o.precision(p); + scientific(o); + o << x; + std::string a = o.str(); + o.str(""); + o << y; + return a == o.str(); +} + +int main() +{ + { + typedef double T; + T a1[] = {-.9, -.5, 0., .5, .75}; + T a3[] = {-7.1629787019902447e-01, + -4.6211715726000974e-01, + 0.0000000000000000e+00, + 4.6211715726000974e-01, + 6.3514895238728730e-01}; + const unsigned N = sizeof(a1)/sizeof(a1[0]); + std::valarray<T> v1(a1, N); + std::valarray<T> v3 = tanh(v1); + assert(v3.size() == v1.size()); + for (int i = 0; i < v3.size(); ++i) + assert(is_about(v3[i], a3[i], 10)); + } +} |