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

Side by Side Diff: base/string_util_unittest.cc

Issue 3366011: base: Move SplitStringDontTrim functions from string_util.h to string_split.h (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: remove dchecks Created 10 years, 3 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 | « base/string_util.cc ('k') | chrome/plugin/chrome_plugin_host.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <math.h> 5 #include <math.h>
6 #include <stdarg.h> 6 #include <stdarg.h>
7 7
8 #include <limits> 8 #include <limits>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 r.clear(); 755 r.clear();
756 756
757 SplitString(L"\t\ta\t", L'\t', &r); 757 SplitString(L"\t\ta\t", L'\t', &r);
758 ASSERT_EQ(4U, r.size()); 758 ASSERT_EQ(4U, r.size());
759 EXPECT_EQ(r[0], L""); 759 EXPECT_EQ(r[0], L"");
760 EXPECT_EQ(r[1], L""); 760 EXPECT_EQ(r[1], L"");
761 EXPECT_EQ(r[2], L"a"); 761 EXPECT_EQ(r[2], L"a");
762 EXPECT_EQ(r[3], L""); 762 EXPECT_EQ(r[3], L"");
763 r.clear(); 763 r.clear();
764 764
765 SplitStringDontTrim(L"\t\ta\t", L'\t', &r);
766 ASSERT_EQ(4U, r.size());
767 EXPECT_EQ(r[0], L"");
768 EXPECT_EQ(r[1], L"");
769 EXPECT_EQ(r[2], L"a");
770 EXPECT_EQ(r[3], L"");
771 r.clear();
772
773 SplitString(L"\ta\t\nb\tcc", L'\n', &r); 765 SplitString(L"\ta\t\nb\tcc", L'\n', &r);
774 ASSERT_EQ(2U, r.size()); 766 ASSERT_EQ(2U, r.size());
775 EXPECT_EQ(r[0], L"a"); 767 EXPECT_EQ(r[0], L"a");
776 EXPECT_EQ(r[1], L"b\tcc"); 768 EXPECT_EQ(r[1], L"b\tcc");
777 r.clear(); 769 r.clear();
778
779 SplitStringDontTrim(L"\ta\t\nb\tcc", L'\n', &r);
780 ASSERT_EQ(2U, r.size());
781 EXPECT_EQ(r[0], L"\ta\t");
782 EXPECT_EQ(r[1], L"b\tcc");
783 r.clear();
784 } 770 }
785 771
786 // Test for Tokenize 772 // Test for Tokenize
787 template <typename STR> 773 template <typename STR>
788 void TokenizeTest() { 774 void TokenizeTest() {
789 std::vector<STR> r; 775 std::vector<STR> r;
790 size_t size; 776 size_t size;
791 777
792 size = Tokenize(STR("This is a string"), STR(" "), &r); 778 size = Tokenize(STR("This is a string"), STR(" "), &r);
793 EXPECT_EQ(4U, size); 779 EXPECT_EQ(4U, size);
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 EXPECT_FALSE(ContainsOnlyChars("Hello", "")); 1224 EXPECT_FALSE(ContainsOnlyChars("Hello", ""));
1239 1225
1240 EXPECT_TRUE(ContainsOnlyChars("", "1234")); 1226 EXPECT_TRUE(ContainsOnlyChars("", "1234"));
1241 EXPECT_TRUE(ContainsOnlyChars("1", "1234")); 1227 EXPECT_TRUE(ContainsOnlyChars("1", "1234"));
1242 EXPECT_TRUE(ContainsOnlyChars("1", "4321")); 1228 EXPECT_TRUE(ContainsOnlyChars("1", "4321"));
1243 EXPECT_TRUE(ContainsOnlyChars("123", "4321")); 1229 EXPECT_TRUE(ContainsOnlyChars("123", "4321"));
1244 EXPECT_FALSE(ContainsOnlyChars("123a", "4321")); 1230 EXPECT_FALSE(ContainsOnlyChars("123a", "4321"));
1245 } 1231 }
1246 1232
1247 } // namespace base 1233 } // namespace base
OLDNEW
« no previous file with comments | « base/string_util.cc ('k') | chrome/plugin/chrome_plugin_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698