Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: base/containers/flat_set_unittest.cc

Issue 2723853002: Implementing erase/erase_if functions from library fundamentals ts: (Closed)
Patch Set: Compilation on linux. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/containers/flat_set.h ('k') | base/stl_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/containers/flat_set.h" 5 #include "base/containers/flat_set.h"
6 6
7 // Following tests are ported and extended tests from libcpp for std::set. 7 // Following tests are ported and extended tests from libcpp for std::set.
8 // They can be found here: 8 // They can be found here:
9 // https://github.com/llvm-mirror/libcxx/tree/master/test/std/containers/associa tive/set 9 // https://github.com/llvm-mirror/libcxx/tree/master/test/std/containers/associa tive/set
10 // 10 //
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 1235
1236 EXPECT_EQ(biggest, biggest); 1236 EXPECT_EQ(biggest, biggest);
1237 EXPECT_NE(biggest, smallest); 1237 EXPECT_NE(biggest, smallest);
1238 EXPECT_LT(smallest, middle); 1238 EXPECT_LT(smallest, middle);
1239 EXPECT_LE(smallest, middle); 1239 EXPECT_LE(smallest, middle);
1240 EXPECT_LE(middle, middle); 1240 EXPECT_LE(middle, middle);
1241 EXPECT_GT(biggest, middle); 1241 EXPECT_GT(biggest, middle);
1242 EXPECT_GE(biggest, middle); 1242 EXPECT_GE(biggest, middle);
1243 EXPECT_GE(biggest, biggest); 1243 EXPECT_GE(biggest, biggest);
1244 } 1244 }
1245
1246 TEST(FlatSet, EraseIf) {
1247 IntSet x;
1248 base::EraseIf(x, [](int) { return false; });
1249 EXPECT_THAT(x, ElementsAre());
1250
1251 x = {1, 2, 3};
1252 base::EraseIf(x, [](int elem) { return !(elem & 1); });
1253 EXPECT_THAT(x, ElementsAre(1, 3));
1254
1255 x = {1, 2, 3, 4};
1256 base::EraseIf(x, [](int elem) { return elem & 1; });
1257 EXPECT_THAT(x, ElementsAre(2, 4));
1258 }
OLDNEW
« no previous file with comments | « base/containers/flat_set.h ('k') | base/stl_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698