darin@chromium.org | ba896ff | 2013-06-18 06:36:41 +0900 | [diff] [blame] | 1 | // Copyright 2013 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 "base/strings/nullable_string16.h" |
| 6 | #include "base/strings/utf_string_conversions.h" |
| 7 | #include "testing/gtest/include/gtest/gtest.h" |
| 8 | |
| 9 | namespace base { |
| 10 | |
| 11 | TEST(NullableString16Test, DefaultConstructor) { |
| 12 | NullableString16 s; |
| 13 | EXPECT_TRUE(s.is_null()); |
| 14 | EXPECT_EQ(string16(), s.string()); |
| 15 | } |
| 16 | |
| 17 | TEST(NullableString16Test, Equals) { |
| 18 | NullableString16 a(ASCIIToUTF16("hello"), false); |
| 19 | NullableString16 b(ASCIIToUTF16("hello"), false); |
| 20 | EXPECT_EQ(a, b); |
| 21 | } |
| 22 | |
| 23 | TEST(NullableString16Test, NotEquals) { |
| 24 | NullableString16 a(ASCIIToUTF16("hello"), false); |
| 25 | NullableString16 b(ASCIIToUTF16("world"), false); |
| 26 | EXPECT_NE(a, b); |
| 27 | } |
| 28 | |
| 29 | TEST(NullableString16Test, NotEqualsNull) { |
| 30 | NullableString16 a(ASCIIToUTF16("hello"), false); |
| 31 | NullableString16 b; |
| 32 | EXPECT_NE(a, b); |
| 33 | } |
| 34 | |
| 35 | } // namespace base |