llvm.org GIT mirror llvm / bac9a5d
Fix warnings in ImmutableSetTest and SequenceTest. Doing "I++" inside of an EXPECT_* triggers warning: expression with side effects has no effect in an unevaluated context because EXPECT_* partially expands to EqHelper<(sizeof(::testing::internal::IsNullLiteralHelper(i++)) == 1)> which is an unevaluated context. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275717 91177308-0d34-0410-b5e6-96231b3b80d8 Justin Lebar 4 years ago
2 changed file(s) with 10 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
180180
181181 int i = 0;
182182 for (ImmutableSet::iterator I = S.begin(), E = S.end(); I != E; ++I) {
183 ASSERT_EQ(i++, *I);
183 ASSERT_EQ(i, *I);
184 i++;
184185 }
185186 ASSERT_EQ(0, i);
186187
187188 i = 0;
188189 for (ImmutableSet::iterator I = S2.begin(), E = S2.end(); I != E; ++I) {
189 ASSERT_EQ(i++, *I);
190 ASSERT_EQ(i, *I);
191 i++;
190192 }
191193 ASSERT_EQ(3, i);
192194
193195 i = 0;
194196 for (ImmutableSet::iterator I = S3.begin(), E = S3.end(); I != E; I++) {
195 ASSERT_EQ(i++, *I);
197 ASSERT_EQ(i, *I);
198 i++;
196199 }
197200 ASSERT_EQ(6, i);
198201 }
1717
1818 TEST(SequenceTest, Basic) {
1919 int x = 0;
20 for (int i : seq(0, 10))
21 EXPECT_EQ(x++, i);
20 for (int i : seq(0, 10)) {
21 EXPECT_EQ(x, i);
22 x++;
23 }
2224 EXPECT_EQ(10, x);
2325
2426 auto my_seq = seq(0, 4);