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

Side by Side Diff: chrome/common/string_index_unittest.cc

Issue 8236002: Create StringOrdinal to allow placement of strings in sorted lists (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 2 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 | Annotate | Revision Log
« chrome/common/string_index.cc ('K') | « chrome/common/string_index.cc ('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 (c) 2011 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 "chrome/common/string_index.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7
8
9 class StringIndexTest: public testing::Test {
10 protected:
11 StringIndex string_index_;
12 };
13
14 TEST_F(StringIndexTest, CreateStringBetweenSingleDigit) {
15 EXPECT_EQ("C", string_index_.CreateStringBetween("B", "D"));
16 EXPECT_EQ("C", string_index_.CreateStringBetween("B", "E"));
17 EXPECT_EQ("D", string_index_.CreateStringBetween("B", "F"));
18
19 EXPECT_EQ("BM", string_index_.CreateStringBetween("B","C"));
20 EXPECT_EQ("CM", string_index_.CreateStringBetween("C","D"));
21 }
22
23 TEST_F(StringIndexTest, CreateStringBetweenEnd) {
24 EXPECT_EQ("ZM", string_index_.CreateStringBetween("Z", ""));
25 EXPECT_EQ("ZZM", string_index_.CreateStringBetween("ZZ", ""));
26 EXPECT_EQ("ZZZYM", string_index_.CreateStringBetween("ZZZY",""));
27 EXPECT_EQ("ZL", string_index_.CreateStringBetween("YY",""));
28 }
29
30 TEST_F(StringIndexTest, CreateStringBetweenStart) {
31 EXPECT_EQ("AM", string_index_.CreateStringBetween("", "B"));
32 EXPECT_EQ("AM", string_index_.CreateStringBetween("", "BB"));
33 EXPECT_EQ("AN", string_index_.CreateStringBetween("", "BC"));
34 EXPECT_EQ("AN", string_index_.CreateStringBetween("", "BD"));
35 }
36
37 TEST_F(StringIndexTest, CreateStringBetweenLastDigitTheSame) {
38 EXPECT_EQ("AN", string_index_.CreateStringBetween("AB", "BB"));
39 EXPECT_EQ("BN", string_index_.CreateStringBetween("BB", "CB"));
40 EXPECT_EQ("BBN", string_index_.CreateStringBetween("BBB", "BCB"));
41 }
OLDNEW
« chrome/common/string_index.cc ('K') | « chrome/common/string_index.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698