Lines Matching defs:Set1

26   std::set<int> Set1 = {1, 2, 3, 4};
29 set_union(Set1, Set2);
30 // Set1 should be the union of input sets Set1 and Set2.
31 EXPECT_THAT(Set1, UnorderedElementsAre(1, 2, 3, 4, 5, 6, 7, 8));
35 Set1.clear();
38 set_union(Set1, Set2);
39 // Set1 should be the union of input sets Set1 and Set2, which in this case
41 EXPECT_THAT(Set1, UnorderedElementsAre(1, 2));
47 std::set<int> Set1 = {1, 2, 3, 4};
50 set_intersect(Set1, Set2);
51 // Set1 should be the intersection of sets Set1 and Set2.
52 EXPECT_THAT(Set1, UnorderedElementsAre(3, 4));
56 Set1 = {1, 2, 3, 4};
59 set_intersect(Set1, Set2);
60 // Set1 should be the intersection of sets Set1 and Set2, which
62 EXPECT_THAT(Set1, IsEmpty());
78 std::set<int> Set1 = {1, 2, 3, 4};
82 Result = set_intersection(Set1, Set2);
83 // Result should be the intersection of sets Set1 and Set2.
85 // Set1 and Set2 should not be touched.
86 EXPECT_THAT(Set1, UnorderedElementsAre(1, 2, 3, 4));
89 Set1 = {1, 2, 3, 4};
92 Result = set_intersection(Set1, Set2);
93 // Result should be the intersection of sets Set1 and Set2, which
96 // Set1 and Set2 should not be touched.
97 EXPECT_THAT(Set1, UnorderedElementsAre(1, 2, 3, 4));
100 Set1 = {5, 6};
103 Result = set_intersection(Set1, Set2);
104 // Result should be the intersection of sets Set1 and Set2, which
109 // Set1 and Set2 should not be touched.
110 EXPECT_THAT(Set1, UnorderedElementsAre(5, 6));
115 std::set<int> Set1 = {1, 2, 3, 4};
119 Result = set_difference(Set1, Set2);
120 // Result should be Set1 - Set2, leaving only {1, 2}.
122 // Set1 and Set2 should not be touched.
123 EXPECT_THAT(Set1, UnorderedElementsAre(1, 2, 3, 4));
126 Set1 = {1, 2, 3, 4};
129 Result = set_difference(Set1, Set2);
130 // Result should be Set1 - Set2, which should be empty.
132 // Set1 and Set2 should not be touched.
133 EXPECT_THAT(Set1, UnorderedElementsAre(1, 2, 3, 4));
136 Set1 = {1, 2, 3, 4};
139 Result = set_difference(Set1, Set2);
140 // Result should be Set1 - Set2, which should be Set1 as they are
143 // Set1 and Set2 should not be touched.
144 EXPECT_THAT(Set1, UnorderedElementsAre(1, 2, 3, 4));
149 std::set<int> Set1 = {1, 2, 3, 4};
152 set_subtract(Set1, Set2);
153 // Set1 should get Set1 - Set2, leaving only {1, 2}.
154 EXPECT_THAT(Set1, UnorderedElementsAre(1, 2));
158 Set1 = {1, 2, 3, 4};
161 set_subtract(Set1, Set2);
162 // Set1 should get Set1 - Set2, which should be empty.
163 EXPECT_THAT(Set1, IsEmpty());
167 Set1 = {1, 2, 3, 4};
170 set_subtract(Set1, Set2);
171 // Set1 should get Set1 - Set2, which should be Set1 as they are
173 EXPECT_THAT(Set1, UnorderedElementsAre(1, 2, 3, 4));
181 // Set1.size() < Set2.size()
182 SmallPtrSet<int *, 4> Set1 = {&A[0], &A[1]};
184 set_subtract(Set1, Set2);
185 EXPECT_THAT(Set1, UnorderedElementsAre(&A[0]));
187 // Set1.size() > Set2.size()
188 Set1 = {&A[0], &A[1], &A[2]};
190 set_subtract(Set1, Set2);
191 EXPECT_THAT(Set1, UnorderedElementsAre(&A[1]));
197 // Set1.size() < Set2.size()
198 SmallPtrSet<int *, 4> Set1 = {&A[0], &A[1]};
200 set_subtract(Set1, Set2);
201 EXPECT_THAT(Set1, UnorderedElementsAre(&A[0]));
203 // Set1.size() > Set2.size()
204 Set1 = {&A[0], &A[1], &A[2]};
206 set_subtract(Set1, Set2);
207 EXPECT_THAT(Set1, UnorderedElementsAre(&A[1]));
213 std::set<int> Set1 = {1, 2, 3, 4};
216 set_subtract(Set1, Set2, Removed, Remaining);
217 // Set1 should get Set1 - Set2, leaving only {1, 2}.
218 EXPECT_THAT(Set1, UnorderedElementsAre(1, 2));
221 // We should get back that {3, 4} from Set2 were removed from Set1, and {5, 6}
222 // were not removed from Set1.
226 Set1 = {1, 2, 3, 4};
231 set_subtract(Set1, Set2, Removed, Remaining);
232 // Set1 should get Set1 - Set2, which should be empty.
233 EXPECT_THAT(Set1, IsEmpty());
236 // Set should get back that all of Set2 was removed from Set1, and nothing
237 // left in Set2 was not removed from Set1.
241 Set1 = {1, 2, 3, 4};
246 set_subtract(Set1, Set2, Removed, Remaining);
247 // Set1 should get Set1 - Set2, which should be Set1 as they are
249 EXPECT_THAT(Set1, UnorderedElementsAre(1, 2, 3, 4));
253 // Set should get back that none of Set2 was removed from Set1, and all
254 // of Set2 was not removed from Set1.
259 std::set<int> Set1 = {1, 2, 3, 4};
261 EXPECT_FALSE(set_is_subset(Set1, Set2));
263 Set1 = {1, 2, 3, 4};
265 EXPECT_TRUE(set_is_subset(Set1, Set2));
267 Set1 = {1, 2};
269 EXPECT_TRUE(set_is_subset(Set1, Set2));
271 Set1 = {1, 2};
273 EXPECT_FALSE(set_is_subset(Set1, Set2));