greater_equal_valarray_value.pass.cpp 940 B

12345678910111213141516171819202122232425262728293031323334
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is dual licensed under the MIT and the University of Illinois Open
  6. // Source Licenses. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // <valarray>
  10. // template<class T> class valarray;
  11. // template<class T>
  12. // valarray<bool>
  13. // operator>=(const valarray<T>& x, const T& y);
  14. #include <valarray>
  15. #include <cassert>
  16. int main()
  17. {
  18. {
  19. typedef int T;
  20. T a1[] = {1, 2, 3, 4, 0};
  21. bool a3[] = {false, true, true, true, false};
  22. const unsigned N = sizeof(a1)/sizeof(a1[0]);
  23. std::valarray<T> v1(a1, N);
  24. std::valarray<bool> v3 = v1 >= 2;
  25. assert(v1.size() == v3.size());
  26. for (int i = 0; i < v1.size(); ++i)
  27. assert(v3[i] == a3[i]);
  28. }
  29. }