diff options
author | Eric Fiselier <eric@efcs.ca> | 2014-12-20 01:40:03 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2014-12-20 01:40:03 +0000 |
commit | 5a83710e371fe68a06e6e3876c6a2c8b820a8976 (patch) | |
tree | afde4c82ad6704681781c5cd49baa3fbd05c85db /libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison | |
parent | f11e8eab527fba316c64112f6e05de1a79693a3e (diff) | |
download | bcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.tar.gz bcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.zip |
Move test into test/std subdirectory.
llvm-svn: 224658
Diffstat (limited to 'libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison')
24 files changed, 884 insertions, 0 deletions
diff --git a/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..af2a1b3ed79 --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_value.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_value.pass.cpp new file mode 100644 index 00000000000..f34fe964257 --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_value.pass.cpp @@ -0,0 +1,45 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_value_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_value_valarray.pass.cpp new file mode 100644 index 00000000000..c323d13ff42 --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_value_valarray.pass.cpp @@ -0,0 +1,45 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..6222e91595d --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_value.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_value.pass.cpp new file mode 100644 index 00000000000..dca65055b2a --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_value.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_value_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_value_valarray.pass.cpp new file mode 100644 index 00000000000..532219e2e85 --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_value_valarray.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..75e62693bae --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_value.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_value.pass.cpp new file mode 100644 index 00000000000..020706dfa2e --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_value.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_value_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_value_valarray.pass.cpp new file mode 100644 index 00000000000..faf2003adb7 --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_value_valarray.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..3276085f37d --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_value.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_value.pass.cpp new file mode 100644 index 00000000000..1ab774cdfb4 --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_value.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_value_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_value_valarray.pass.cpp new file mode 100644 index 00000000000..c5012d6fc0e --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_value_valarray.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..ceb6658833e --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_value.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_value.pass.cpp new file mode 100644 index 00000000000..4a391a3f379 --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_value.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_value_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_value_valarray.pass.cpp new file mode 100644 index 00000000000..cf34e18b92c --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_value_valarray.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..0fa99488b79 --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_value.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_value.pass.cpp new file mode 100644 index 00000000000..7a47c900a8f --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_value.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_value_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_value_valarray.pass.cpp new file mode 100644 index 00000000000..4d6cbadcc8b --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_value_valarray.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..c9675a9ce3e --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_value.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_value.pass.cpp new file mode 100644 index 00000000000..9daa7289b71 --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_value.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_value_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_value_valarray.pass.cpp new file mode 100644 index 00000000000..37439aabcb2 --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_value_valarray.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_valarray.pass.cpp new file mode 100644 index 00000000000..9a2f84e8f7d --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_valarray.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_value.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_value.pass.cpp new file mode 100644 index 00000000000..789df5badf0 --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_value.pass.cpp @@ -0,0 +1,45 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_value_valarray.pass.cpp b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_value_valarray.pass.cpp new file mode 100644 index 00000000000..d6690596027 --- /dev/null +++ b/libcxx/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_value_valarray.pass.cpp @@ -0,0 +1,45 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <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]); + } +} |