]>
Commit | Line | Data |
---|---|---|
ac317859 PC |
1 | // 2005-01-17 Paolo Carlini <pcarlini@suse.de> |
2 | ||
aa118a03 | 3 | // Copyright (C) 2005-2014 Free Software Foundation, Inc. |
ac317859 PC |
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 | |
748086b7 | 8 | // Free Software Foundation; either version 3, or (at your option) |
ac317859 PC |
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 | |
748086b7 JJ |
17 | // with this library; see the file COPYING3. If not see |
18 | // <http://www.gnu.org/licenses/>. | |
ac317859 | 19 | // |
ac317859 PC |
20 | |
21 | #include <set> | |
22 | #include <testsuite_hooks.h> | |
23 | ||
24 | // A few tests for insert with hint, in the occasion of libstdc++/19422 | |
25 | // and libstdc++/19433. | |
26 | void test01() | |
27 | { | |
28 | bool test __attribute__((unused)) = true; | |
29 | using namespace std; | |
30 | ||
31 | multiset<int> ms0, ms1; | |
32 | multiset<int>::iterator iter1; | |
33 | ||
34 | ms0.insert(1); | |
35 | ms1.insert(ms1.end(), 1); | |
36 | VERIFY( ms0 == ms1 ); | |
37 | ||
38 | ms0.insert(3); | |
39 | ms1.insert(ms1.begin(), 3); | |
40 | VERIFY( ms0 == ms1 ); | |
41 | ||
42 | ms0.insert(4); | |
43 | iter1 = ms1.insert(ms1.end(), 4); | |
44 | VERIFY( ms0 == ms1 ); | |
45 | ||
46 | ms0.insert(6); | |
47 | ms1.insert(iter1, 6); | |
48 | VERIFY( ms0 == ms1 ); | |
49 | ||
50 | ms0.insert(2); | |
51 | ms1.insert(ms1.begin(), 2); | |
52 | VERIFY( ms0 == ms1 ); | |
53 | ||
54 | ms0.insert(7); | |
55 | ms1.insert(ms1.end(), 7); | |
56 | VERIFY( ms0 == ms1 ); | |
57 | ||
58 | ms0.insert(5); | |
59 | ms1.insert(ms1.find(4), 5); | |
60 | VERIFY( ms0 == ms1 ); | |
61 | ||
62 | ms0.insert(0); | |
63 | ms1.insert(ms1.end(), 0); | |
64 | VERIFY( ms0 == ms1 ); | |
65 | ||
66 | ms0.insert(8); | |
67 | ms1.insert(ms1.find(3), 8); | |
68 | VERIFY( ms0 == ms1 ); | |
69 | ||
70 | ms0.insert(9); | |
71 | ms1.insert(ms1.end(), 9); | |
72 | VERIFY( ms0 == ms1 ); | |
73 | ||
74 | ms0.insert(10); | |
75 | ms1.insert(ms1.begin(), 10); | |
76 | VERIFY( ms0 == ms1 ); | |
77 | } | |
78 | ||
ac317859 PC |
79 | int main () |
80 | { | |
81 | test01(); | |
82 | return 0; | |
83 | } |