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