]>
Commit | Line | Data |
---|---|---|
e9e90c1f PC |
1 | // 2007-01-19 Paolo Carlini <pcarlini@suse.de> |
2 | ||
3 | // Copyright (C) 2007 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 2, 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 Pred 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 COPYING. If not, write to the Free | |
18 | // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | |
19 | // USA. | |
20 | ||
21 | // 25.2.5 [lib.alg.fill] Fill. | |
22 | ||
23 | #include <algorithm> | |
24 | #include <vector> | |
25 | #include <testsuite_hooks.h> | |
26 | ||
27 | void | |
28 | test01() | |
29 | { | |
30 | using namespace std; | |
31 | bool test __attribute__((unused)) = true; | |
32 | ||
33 | const int A1[] = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3}; | |
34 | const int N1 = sizeof(A1) / sizeof(int); | |
35 | ||
36 | int i1[N1]; | |
37 | fill(i1, i1 + N1, 3); | |
38 | VERIFY( equal(i1, i1 + N1, A1) ); | |
39 | ||
40 | vector<int> v1(N1); | |
41 | fill(v1.begin(), v1.end(), 3); | |
42 | VERIFY( equal(v1.begin(), v1.end(), A1) ); | |
43 | ||
44 | const char A2[] = {'\3', '\3', '\3', '\3', '\3', | |
45 | '\3', '\3', '\3', '\3', '\3'}; | |
46 | const int N2 = sizeof(A2) / sizeof(char); | |
47 | ||
48 | char i2[N2]; | |
49 | fill(i2, i2 + N2, '\3'); | |
50 | VERIFY( equal(i2, i2 + N2, A2) ); | |
51 | ||
52 | vector<char> v2(N2); | |
53 | fill(v2.begin(), v2.end(), '\3'); | |
54 | VERIFY( equal(v2.begin(), v2.end(), A2) ); | |
55 | ||
56 | #ifdef _GLIBCXX_USE_WCHAR_T | |
57 | const wchar_t A3[] = {L'\3', L'\3', L'\3', L'\3', L'\3', | |
58 | L'\3', L'\3', L'\3', L'\3', L'\3'}; | |
59 | const int N3 = sizeof(A3) / sizeof(wchar_t); | |
60 | ||
61 | wchar_t i3[N3]; | |
62 | fill(i3, i3 + N3, L'\3'); | |
63 | VERIFY( equal(i3, i3 + N3, A3) ); | |
64 | ||
65 | vector<wchar_t> v3(N3); | |
66 | fill(v3.begin(), v3.end(), L'\3'); | |
67 | VERIFY( equal(v3.begin(), v3.end(), A3) ); | |
68 | #endif | |
69 | } | |
70 | ||
71 | int | |
72 | main() | |
73 | { | |
74 | test01(); | |
75 | return 0; | |
76 | } |