Don't switch browser locale on secondary user login
[chromium-blink-merge.git] / base / stl_util_unittest.cc
blob63d5c5c1ee7cf21bb5e223c34c61b0a1c06fb6cd
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.
5 #include "base/stl_util.h"
7 #include <set>
9 #include "testing/gtest/include/gtest/gtest.h"
11 namespace base {
12 namespace {
14 TEST(STLUtilTest, STLIsSorted) {
16 std::set<int> set;
17 set.insert(24);
18 set.insert(1);
19 set.insert(12);
20 EXPECT_TRUE(STLIsSorted(set));
24 std::vector<int> vector;
25 vector.push_back(1);
26 vector.push_back(1);
27 vector.push_back(4);
28 vector.push_back(64);
29 vector.push_back(12432);
30 EXPECT_TRUE(STLIsSorted(vector));
31 vector.back() = 1;
32 EXPECT_FALSE(STLIsSorted(vector));
36 TEST(STLUtilTest, STLSetDifference) {
37 std::set<int> a1;
38 a1.insert(1);
39 a1.insert(2);
40 a1.insert(3);
41 a1.insert(4);
43 std::set<int> a2;
44 a2.insert(3);
45 a2.insert(4);
46 a2.insert(5);
47 a2.insert(6);
48 a2.insert(7);
51 std::set<int> difference;
52 difference.insert(1);
53 difference.insert(2);
54 EXPECT_EQ(difference, STLSetDifference<std::set<int> >(a1, a2));
58 std::set<int> difference;
59 difference.insert(5);
60 difference.insert(6);
61 difference.insert(7);
62 EXPECT_EQ(difference, STLSetDifference<std::set<int> >(a2, a1));
66 std::vector<int> difference;
67 difference.push_back(1);
68 difference.push_back(2);
69 EXPECT_EQ(difference, STLSetDifference<std::vector<int> >(a1, a2));
73 std::vector<int> difference;
74 difference.push_back(5);
75 difference.push_back(6);
76 difference.push_back(7);
77 EXPECT_EQ(difference, STLSetDifference<std::vector<int> >(a2, a1));
81 } // namespace
82 } // namespace base