Lines Matching refs:Set
19 // Empty set tests.
21 USet Set;
22 EXPECT_TRUE(Set.empty());
23 EXPECT_TRUE(Set.begin() == Set.end());
24 EXPECT_EQ(0u, Set.size());
26 Set.setUniverse(10);
28 // Lookups on empty set.
29 EXPECT_TRUE(Set.find(0) == Set.end());
30 EXPECT_TRUE(Set.find(9) == Set.end());
33 const USet &CSet = Set;
42 // Single entry set tests.
44 USet Set;
45 Set.setUniverse(10);
46 std::pair<USet::iterator, bool> IP = Set.insert(5);
48 EXPECT_TRUE(IP.first == Set.begin());
50 EXPECT_FALSE(Set.empty());
51 EXPECT_FALSE(Set.begin() == Set.end());
52 EXPECT_TRUE(Set.begin() + 1 == Set.end());
53 EXPECT_EQ(1u, Set.size());
55 EXPECT_TRUE(Set.find(0) == Set.end());
56 EXPECT_TRUE(Set.find(9) == Set.end());
58 EXPECT_FALSE(Set.count(0));
59 EXPECT_TRUE(Set.count(5));
62 IP = Set.insert(5);
64 EXPECT_TRUE(IP.first == Set.begin());
67 EXPECT_FALSE(Set.erase(1));
68 EXPECT_EQ(1u, Set.size());
69 EXPECT_EQ(5u, *Set.begin());
72 USet::iterator I = Set.find(5);
73 EXPECT_TRUE(I == Set.begin());
74 I = Set.erase(I);
75 EXPECT_TRUE(I == Set.end());
76 EXPECT_TRUE(Set.empty());
79 // Multiple entry set tests.
81 USet Set;
82 Set.setUniverse(10);
84 Set.insert(5);
85 Set.insert(3);
86 Set.insert(2);
87 Set.insert(1);
88 Set.insert(4);
89 EXPECT_EQ(5u, Set.size());
92 USet::const_iterator I = Set.begin();
103 EXPECT_TRUE(I == Set.end());
106 std::pair<USet::iterator, bool> IP = Set.insert(3);
108 EXPECT_TRUE(IP.first == Set.begin() + 1);
111 EXPECT_TRUE(Set.erase(4));
112 EXPECT_EQ(4u, Set.size());
113 EXPECT_FALSE(Set.count(4));
114 EXPECT_FALSE(Set.erase(4));
115 EXPECT_EQ(4u, Set.size());
116 EXPECT_FALSE(Set.count(4));
119 EXPECT_TRUE(Set.count(5));
120 EXPECT_TRUE(Set.find(5) == Set.begin());
121 EXPECT_TRUE(Set.erase(5));
122 EXPECT_EQ(3u, Set.size());
123 EXPECT_FALSE(Set.count(5));
124 EXPECT_FALSE(Set.erase(5));
125 EXPECT_EQ(3u, Set.size());
126 EXPECT_FALSE(Set.count(5));
128 Set.insert(6);
129 Set.insert(7);
130 EXPECT_EQ(5u, Set.size());
133 I = Set.erase(Set.end() - 1);
134 EXPECT_TRUE(I == Set.end());
135 EXPECT_EQ(4u, Set.size());
138 I = Set.erase(Set.begin() + 1);
139 EXPECT_TRUE(I == Set.begin() + 1);
142 Set.clear();
143 EXPECT_FALSE(Set.count(5));
144 Set.setUniverse(1000);
148 Set.insert(i);
151 Set.erase(i);
154 EXPECT_TRUE(Set.count(i));
156 EXPECT_FALSE(Set.count(99));
157 EXPECT_FALSE(Set.count(800));
158 EXPECT_EQ(700u, Set.size());
169 ASet Set;
170 Set.setUniverse(10);
171 Set.insert(Alt(1005));
173 ASet::iterator I = Set.find(5);
174 ASSERT_TRUE(I == Set.begin());
177 Set.insert(Alt(1006));
178 Set.insert(Alt(1006));
179 I = Set.erase(Set.begin());
180 ASSERT_TRUE(I == Set.begin());
183 EXPECT_FALSE(Set.erase(5));
184 EXPECT_TRUE(Set.erase(6));