]>
Commit | Line | Data |
---|---|---|
af4beb4b PC |
1 | // { dg-options "-std=gnu++0x" } |
2 | ||
3 | // Copyright (C) 2009 Free Software Foundation | |
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 | bool test __attribute__((unused)) = true; | |
27 | using namespace std; | |
28 | ||
29 | valarray<int> v1; | |
30 | ||
31 | v1 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; | |
32 | VERIFY( v1.size() == 10 ); | |
33 | VERIFY( v1.min() == -1 ); | |
34 | VERIFY( v1.max() == -1 ); | |
35 | ||
36 | valarray<int> v2(0, 10); | |
37 | ||
fcbaa582 PC |
38 | v2 = { }; |
39 | VERIFY( v2.size() == 0 ); | |
af4beb4b | 40 | |
fcbaa582 | 41 | valarray<int> v3(0, 10); |
af4beb4b | 42 | |
fcbaa582 PC |
43 | v3 = { -1, -1, -1, -1, -1 }; |
44 | VERIFY( v3.size() == 5 ); | |
af4beb4b PC |
45 | VERIFY( v3.min() == -1 ); |
46 | VERIFY( v3.max() == -1 ); | |
47 | ||
fcbaa582 | 48 | valarray<int> v4(0, 5); |
af4beb4b PC |
49 | |
50 | v4 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; | |
51 | VERIFY( v4.size() == 10 ); | |
52 | VERIFY( v4.min() == -1 ); | |
53 | VERIFY( v4.max() == -1 ); | |
fcbaa582 PC |
54 | |
55 | valarray<int> v5(0, 10); | |
56 | ||
57 | v5 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; | |
58 | VERIFY( v5.size() == 10 ); | |
59 | VERIFY( v5.min() == -1 ); | |
60 | VERIFY( v5.max() == -1 ); | |
af4beb4b PC |
61 | } |
62 | ||
63 | int main() | |
64 | { | |
65 | test01(); | |
66 | return 0; | |
67 | } |