Reverting merge from trunk
[official-gcc.git] / libstdc++-v3 / testsuite / 23_containers / set / modifiers / insert / 1.cc
blobb95bbfd7097d811bde91565f4be32c8ab41ad48b
1 // 2005-01-17 Paolo Carlini <pcarlini@suse.de>
3 // Copyright (C) 2005-2013 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.
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.
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/>.
21 #include <set>
22 #include <testsuite_hooks.h>
24 // A few tests for insert with hint, in the occasion of libstdc++/19422
25 // and libstdc++/19433.
26 void test01()
28 bool test __attribute__((unused)) = true;
29 using namespace std;
31 set<int> s0, s1;
32 set<int>::iterator iter1;
34 s0.insert(1);
35 s1.insert(s1.end(), 1);
36 VERIFY( s0 == s1 );
38 s0.insert(3);
39 s1.insert(s1.begin(), 3);
40 VERIFY( s0 == s1 );
42 s0.insert(4);
43 iter1 = s1.insert(s1.end(), 4);
44 VERIFY( s0 == s1 );
46 s0.insert(6);
47 s1.insert(iter1, 6);
48 VERIFY( s0 == s1 );
50 s0.insert(2);
51 s1.insert(s1.begin(), 2);
52 VERIFY( s0 == s1 );
54 s0.insert(7);
55 s1.insert(s1.end(), 7);
56 VERIFY( s0 == s1 );
58 s0.insert(5);
59 s1.insert(s1.find(4), 5);
60 VERIFY( s0 == s1 );
62 s0.insert(0);
63 s1.insert(s1.end(), 0);
64 VERIFY( s0 == s1 );
66 s0.insert(8);
67 s1.insert(s1.find(3), 8);
68 VERIFY( s0 == s1 );
70 s0.insert(9);
71 s1.insert(s1.end(), 9);
72 VERIFY( s0 == s1 );
74 s0.insert(10);
75 s1.insert(s1.begin(), 10);
76 VERIFY( s0 == s1 );
79 int main ()
81 test01();
82 return 0;