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

Side by Side Diff: tools/gn/pointer_set_unittest.cc

Issue 1494883002: GN: Makes GN output deterministic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
(Empty)
1 // Copyright (c) 2015 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.
mithro-old 2015/12/03 05:20:31 You could probably use a bunch more tests here. D
Zachary Forman 2015/12/03 07:27:02 I've refactored so that we should be as safe as a
4
5 #include <string>
6 #include <vector>
7
8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "tools/gn/pointer_set.h"
10
11 TEST(PointerSet, Sorted) {
12 std::vector<int> vals{1, 55, 3};
13 PointerSet<int> ps;
14 ps.insert(&vals[0]);
15 ps.insert(&vals[1]);
16 ps.insert(&vals[2]);
17 EXPECT_EQ(1, **ps.begin());
mithro-old 2015/12/03 05:20:31 These EXPECT_EQs are kind of hard to read. There
Zachary Forman 2015/12/03 07:27:02 Acknowledged. Entire set of tests is dead now anyw
18 EXPECT_EQ(55, **(--ps.end()));
19 EXPECT_EQ(&vals[0], *ps.begin());
20 EXPECT_EQ(&vals[1], *(--ps.end()));
21 }
22
23 TEST(PointerSet, RangeInsertion) {
24 std::vector<std::string> vals{"abc", "zzz", "cab", "abb", "xyz", "lmn"};
25 std::vector<std::string*> ptrs;
26 for (size_t i = 0; i < vals.size(); i++) {
27 ptrs.push_back(&vals[i]);
28 }
29 PointerSet<std::string> ps(ptrs.begin(), ptrs.end());
30 EXPECT_EQ(6ul, ps.size());
31 EXPECT_EQ(&vals[3], *ps.begin());
32 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698