| 1 | // Copyright (C) 2009-2025 Free Software Foundation, Inc. |
| 2 | // |
| 3 | // This file is part of the GNU ISO C++ Library. This library is free |
| 4 | // software; you can redistribute it and/or modify it under the |
| 5 | // terms of the GNU General Public License as published by the |
| 6 | // Free Software Foundation; either version 3, or (at your option) |
| 7 | // any later version. |
| 8 | |
| 9 | // This library is distributed in the hope that it will be useful, |
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | // GNU General Public License for more details. |
| 13 | |
| 14 | // You should have received a copy of the GNU General Public License along |
| 15 | // with this library; see the file COPYING3. If not see |
| 16 | // <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | #include <valarray> |
| 19 | #include <testsuite_hooks.h> |
| 20 | |
| 21 | // DR 630. |
| 22 | void test01() |
| 23 | { |
| 24 | using namespace std; |
| 25 | |
| 26 | valarray<int> v1; |
| 27 | const valarray<int> v2(-1, 10000); |
| 28 | |
| 29 | v1 = v2; |
| 30 | VERIFY( v1.size() == v2.size() ); |
| 31 | VERIFY( (v1 == v2).min() == true ); |
| 32 | |
| 33 | valarray<int> v3(0, 10000); |
| 34 | const valarray<int> v4; |
| 35 | |
| 36 | v3 = v4; |
| 37 | VERIFY( v3.size() == v4.size() ); |
| 38 | VERIFY( v3.size() == 0 ); |
| 39 | |
| 40 | valarray<int> v5(0, 100); |
| 41 | const valarray<int> v6(-1, 10000); |
| 42 | |
| 43 | v5 = v6; |
| 44 | VERIFY( v5.size() == v6.size() ); |
| 45 | VERIFY( (v5 == v6).min() == true ); |
| 46 | |
| 47 | valarray<int> v7(0, 10000); |
| 48 | const valarray<int> v8(-1, 100); |
| 49 | |
| 50 | v7 = v8; |
| 51 | VERIFY( v7.size() == v8.size() ); |
| 52 | VERIFY( (v7 == v8).min() == true ); |
| 53 | } |
| 54 | |
| 55 | int main() |
| 56 | { |
| 57 | test01(); |
| 58 | return 0; |
| 59 | } |