nullable_string16_unittest.cc 936 B

1234567891011121314151617181920212223242526272829303132333435
  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. #include "butil/strings/nullable_string16.h"
  5. #include "butil/strings/utf_string_conversions.h"
  6. #include <gtest/gtest.h>
  7. namespace butil {
  8. TEST(NullableString16Test, DefaultConstructor) {
  9. NullableString16 s;
  10. EXPECT_TRUE(s.is_null());
  11. EXPECT_EQ(string16(), s.string());
  12. }
  13. TEST(NullableString16Test, Equals) {
  14. NullableString16 a(ASCIIToUTF16("hello"), false);
  15. NullableString16 b(ASCIIToUTF16("hello"), false);
  16. EXPECT_EQ(a, b);
  17. }
  18. TEST(NullableString16Test, NotEquals) {
  19. NullableString16 a(ASCIIToUTF16("hello"), false);
  20. NullableString16 b(ASCIIToUTF16("world"), false);
  21. EXPECT_NE(a, b);
  22. }
  23. TEST(NullableString16Test, NotEqualsNull) {
  24. NullableString16 a(ASCIIToUTF16("hello"), false);
  25. NullableString16 b;
  26. EXPECT_NE(a, b);
  27. }
  28. } // namespace butil