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

Side by Side Diff: base/stl_util_unittest.cc

Issue 11415239: Add STLSetDifference to stl_util.h, because std::set_difference is extremely (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add tests Created 8 years 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 | Annotate | Revision Log
« base/stl_util.h ('K') | « base/stl_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <set>
6
7 #include "base/stl_util.h"
willchan no longer on Chromium 2012/12/01 17:22:13 This should go first
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace {
11
12 TEST(STLUtilTest, STLSetDifference) {
13 std::set<int> a1;
14 a1.insert(1);
15 a1.insert(2);
16 a1.insert(3);
17 a1.insert(4);
18
19 std::set<int> a2;
20 a2.insert(3);
21 a2.insert(4);
22 a2.insert(5);
23 a2.insert(6);
24 a2.insert(7);
25
26 {
27 std::set<int> difference;
28 difference.insert(1);
29 difference.insert(2);
30 EXPECT_EQ(difference, STLSetDifference<std::set<int> >(a1, a2));
31 }
32
33 {
34 std::set<int> difference;
35 difference.insert(5);
36 difference.insert(6);
37 difference.insert(7);
38 EXPECT_EQ(difference, STLSetDifference<std::set<int> >(a2, a1));
39 }
40
41 {
42 std::vector<int> difference;
43 difference.push_back(1);
44 difference.push_back(2);
45 EXPECT_EQ(difference, STLSetDifference<std::vector<int> >(a1, a2));
46 }
47
48 {
49 std::vector<int> difference;
50 difference.push_back(5);
51 difference.push_back(6);
52 difference.push_back(7);
53 EXPECT_EQ(difference, STLSetDifference<std::vector<int> >(a2, a1));
54 }
55 }
56
57 } // namespace
OLDNEW
« base/stl_util.h ('K') | « base/stl_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698