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

Unified 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: Adjusting code to comply with code review requests 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 side-by-side diff with in-line comments
Download patch
« chrome/common/string_index.cc ('K') | « chrome/common/string_index.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/string_index_unittest.cc
diff --git a/chrome/common/string_index_unittest.cc b/chrome/common/string_index_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ff955005c81141a0c87a6bddc2466276de0b780f
--- /dev/null
+++ b/chrome/common/string_index_unittest.cc
@@ -0,0 +1,37 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/string_index.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(StringIndexTest, CreateStringBetweenSingleDigit) {
+ EXPECT_EQ("C", StringIndex::CreateStringBetween("B", "D"));
+ EXPECT_EQ("C", StringIndex::CreateStringBetween("B", "E"));
+ EXPECT_EQ("D", StringIndex::CreateStringBetween("B", "F"));
+
+ EXPECT_EQ("BN", StringIndex::CreateStringBetween("B","C"));
+ EXPECT_EQ("CN", StringIndex::CreateStringBetween("C","D"));
+}
+
+TEST(StringIndexTest, CreateStringBetweenEnd) {
+ EXPECT_EQ("YN", StringIndex::CreateStringBetween("Y", ""));
+ EXPECT_EQ("ZYN", StringIndex::CreateStringBetween("ZY", ""));
+ EXPECT_EQ("ZZZYN", StringIndex::CreateStringBetween("ZZZY",""));
+ EXPECT_EQ("ZL", StringIndex::CreateStringBetween("YY",""));
+ EXPECT_EQ("ZM", StringIndex::CreateStringBetween("YZ",""));
+ EXPECT_EQ("ZM", StringIndex::CreateStringBetween("Z",""));
+}
+
+TEST(StringIndexTest, CreateStringBetweenStart) {
+ EXPECT_EQ("AN", StringIndex::CreateStringBetween("", "B"));
+ EXPECT_EQ("AN", StringIndex::CreateStringBetween("", "BB"));
+ EXPECT_EQ("AO", StringIndex::CreateStringBetween("", "BC"));
+ EXPECT_EQ("AO", StringIndex::CreateStringBetween("", "BD"));
+}
+
+TEST(StringIndexTest, CreateStringBetweenLastDigitTheSame) {
+ EXPECT_EQ("AO", StringIndex::CreateStringBetween("AB", "BB"));
+ EXPECT_EQ("BO", StringIndex::CreateStringBetween("BB", "CB"));
+ EXPECT_EQ("BBO", StringIndex::CreateStringBetween("BBB", "BCB"));
+}
« 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