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

Side by Side Diff: base/string_piece_unittest.cc

Issue 193072: Move StringPiece into the base namespace. It is colliding (Closed)
Patch Set: take 2 Created 11 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_piece.cc ('k') | base/string_util.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <string> 5 #include <string>
6 6
7 #include "base/string_piece.h" 7 #include "base/string_piece.h"
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 using namespace base;
12
11 TEST(StringPieceTest, CheckComparisonOperators) { 13 TEST(StringPieceTest, CheckComparisonOperators) {
12 #define CMP_Y(op, x, y) \ 14 #define CMP_Y(op, x, y) \
13 ASSERT_TRUE( (StringPiece((x)) op StringPiece((y)))); \ 15 ASSERT_TRUE( (StringPiece((x)) op StringPiece((y)))); \
14 ASSERT_TRUE( (StringPiece((x)).compare(StringPiece((y))) op 0)) 16 ASSERT_TRUE( (StringPiece((x)).compare(StringPiece((y))) op 0))
15 17
16 #define CMP_N(op, x, y) \ 18 #define CMP_N(op, x, y) \
17 ASSERT_FALSE(StringPiece((x)) op StringPiece((y))); \ 19 ASSERT_FALSE(StringPiece((x)) op StringPiece((y))); \
18 ASSERT_FALSE(StringPiece((x)).compare(StringPiece((y))) op 0) 20 ASSERT_FALSE(StringPiece((x)).compare(StringPiece((y))) op 0)
19 21
20 CMP_Y(==, "", ""); 22 CMP_Y(==, "", "");
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 533
532 TEST(StringPieceTest, StringCompareNotAmbiguous) { 534 TEST(StringPieceTest, StringCompareNotAmbiguous) {
533 ASSERT_TRUE("hello" == std::string("hello")); 535 ASSERT_TRUE("hello" == std::string("hello"));
534 ASSERT_TRUE("hello" < std::string("world")); 536 ASSERT_TRUE("hello" < std::string("world"));
535 } 537 }
536 538
537 TEST(StringPieceTest, HeterogenousStringPieceEquals) { 539 TEST(StringPieceTest, HeterogenousStringPieceEquals) {
538 ASSERT_TRUE(StringPiece("hello") == std::string("hello")); 540 ASSERT_TRUE(StringPiece("hello") == std::string("hello"));
539 ASSERT_TRUE("hello" == StringPiece("hello")); 541 ASSERT_TRUE("hello" == StringPiece("hello"));
540 } 542 }
OLDNEW
« no previous file with comments | « base/string_piece.cc ('k') | base/string_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698