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

Side by Side Diff: components/sync/base/ordinal_unittest.cc

Issue 2689773002: [Sync] Replace typedef with using. (Closed)
Patch Set: [Sync] Replace typedef with using. Created 3 years, 10 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 | « components/sync/base/node_ordinal.h ('k') | components/sync/base/progress_marker_map.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/sync/base/ordinal.h" 5 #include "components/sync/base/ordinal.h"
6 6
7 #include <cctype> 7 #include <cctype>
8 #include <vector> 8 #include <vector>
9 9
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 13 matching lines...) Expand all
24 static const uint8_t kMaxDigit = '9'; 24 static const uint8_t kMaxDigit = '9';
25 static const size_t kMinLength = 5; 25 static const size_t kMinLength = 5;
26 }; 26 };
27 27
28 struct LargeOrdinalTraits { 28 struct LargeOrdinalTraits {
29 static const uint8_t kZeroDigit = 0; 29 static const uint8_t kZeroDigit = 0;
30 static const uint8_t kMaxDigit = UINT8_MAX; 30 static const uint8_t kMaxDigit = UINT8_MAX;
31 static const size_t kMinLength = 1; 31 static const size_t kMinLength = 1;
32 }; 32 };
33 33
34 typedef Ordinal<TestOrdinalTraits> TestOrdinal; 34 using TestOrdinal = Ordinal<TestOrdinalTraits>;
35 typedef Ordinal<LongOrdinalTraits> LongOrdinal; 35 using LongOrdinal = Ordinal<LongOrdinalTraits>;
36 typedef Ordinal<LargeOrdinalTraits> LargeOrdinal; 36 using LargeOrdinal = Ordinal<LargeOrdinalTraits>;
37 37
38 static_assert(TestOrdinal::kZeroDigit == '0', 38 static_assert(TestOrdinal::kZeroDigit == '0',
39 "incorrect TestOrdinal zero digit"); 39 "incorrect TestOrdinal zero digit");
40 static_assert(TestOrdinal::kOneDigit == '1', "incorrect TestOrdinal one digit"); 40 static_assert(TestOrdinal::kOneDigit == '1', "incorrect TestOrdinal one digit");
41 static_assert(TestOrdinal::kMidDigit == '2', "incorrect TestOrdinal min digit"); 41 static_assert(TestOrdinal::kMidDigit == '2', "incorrect TestOrdinal min digit");
42 static_assert(TestOrdinal::kMaxDigit == '3', "incorrect TestOrdinal max digit"); 42 static_assert(TestOrdinal::kMaxDigit == '3', "incorrect TestOrdinal max digit");
43 static_assert(TestOrdinal::kMidDigitValue == 2, 43 static_assert(TestOrdinal::kMidDigitValue == 2,
44 "incorrect TestOrdinal mid digit value"); 44 "incorrect TestOrdinal mid digit value");
45 static_assert(TestOrdinal::kMaxDigitValue == 3, 45 static_assert(TestOrdinal::kMaxDigitValue == 3,
46 "incorrect TestOrdinal max digit value"); 46 "incorrect TestOrdinal max digit value");
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 std::vector<LongOrdinal> ordinals = sorted_ordinals; 352 std::vector<LongOrdinal> ordinals = sorted_ordinals;
353 std::random_shuffle(ordinals.begin(), ordinals.end()); 353 std::random_shuffle(ordinals.begin(), ordinals.end());
354 std::sort(ordinals.begin(), ordinals.end(), LongOrdinal::LessThanFn()); 354 std::sort(ordinals.begin(), ordinals.end(), LongOrdinal::LessThanFn());
355 EXPECT_TRUE(std::equal(ordinals.begin(), ordinals.end(), 355 EXPECT_TRUE(std::equal(ordinals.begin(), ordinals.end(),
356 sorted_ordinals.begin(), LongOrdinal::EqualsFn())); 356 sorted_ordinals.begin(), LongOrdinal::EqualsFn()));
357 } 357 }
358 358
359 } // namespace 359 } // namespace
360 360
361 } // namespace syncer 361 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/base/node_ordinal.h ('k') | components/sync/base/progress_marker_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698