]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/libstdc++-xmethods/associative-containers.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / libstdc++-xmethods / associative-containers.cc
CommitLineData
52066eae
JW
1// { dg-do run { target c++11 } }
2// { dg-options "-g -O0" }
059e92fd 3
99dee823 4// Copyright (C) 2014-2021 Free Software Foundation, Inc.
059e92fd
SCR
5//
6// This file is part of the GNU ISO C++ Library. This library is free
7// software; you can redistribute it and/or modify it under the
8// terms of the GNU General Public License as published by the
9// Free Software Foundation; either version 3, or (at your option)
10// any later version.
11
12// This library is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16
17// You should have received a copy of the GNU General Public License along
18// with this library; see the file COPYING3. If not see
19// <http://www.gnu.org/licenses/>.
20
21#include <set>
22#include <map>
23#include <unordered_set>
24#include <unordered_map>
25
26int
27main ()
28{
29 std::set<int> s, s1;
30 std::multiset<int> ms, ms1;
31 std::unordered_set<int> us, us1;
32 std::unordered_multiset<int> ums, ums1;
33 std::map<char, int> m, m1;
34 std::multimap<char, int> mm, mm1;
35 std::unordered_map<char, int> um, um1;
36 std::unordered_multimap<char, int> umm, umm1;
37
38 for (int i = 0; i < 100; i++)
39 {
40 s.insert (i % 5);
41 ms.insert (i % 5);
42 us.insert (i % 7);
43 ums.insert (i % 7);
44
45 m.insert(std::pair<char, int> ('a' + i % 5, i));
46 mm.insert(std::pair<char, int> ('a' + i % 5, i));
47 um.insert(std::pair<char, int> ('a' + i % 7, i));
48 umm.insert(std::pair<char, int> ('a' + i % 7, i));
49 }
50
51// { dg-final { note-test s.size() 5 } }
52// { dg-final { note-test s.empty() false } }
53// { dg-final { note-test s1.empty() true } }
54// { dg-final { note-test ms.size() 100 } }
55// { dg-final { note-test ms.empty() false } }
56// { dg-final { note-test ms1.empty() true } }
57// { dg-final { note-test us.size() 7 } }
58// { dg-final { note-test us.empty() false } }
59// { dg-final { note-test us1.empty() true } }
60// { dg-final { note-test ums.size() 100 } }
61// { dg-final { note-test ums.empty() false } }
62// { dg-final { note-test ums1.empty() true } }
63// { dg-final { note-test m.size() 5 } }
64// { dg-final { note-test m.empty() false } }
65// { dg-final { note-test m1.empty() true } }
66// { dg-final { note-test mm.size() 100 } }
67// { dg-final { note-test mm.empty() false } }
68// { dg-final { note-test mm1.empty() true } }
69// { dg-final { note-test um.size() 7 } }
70// { dg-final { note-test um.empty() false } }
71// { dg-final { note-test um1.empty() true } }
72// { dg-final { note-test umm.size() 100 } }
73// { dg-final { note-test umm.empty() false } }
74// { dg-final { note-test umm1.empty() true } }
75
8996b63b
DE
76// { dg-final { whatis-test s.size() std::size_t } }
77// { dg-final { whatis-test s.empty() bool } }
78
059e92fd
SCR
79 return 0; // Mark SPOT
80}
81
82// { dg-final { gdb-test SPOT {} 1 } }