| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 PDFium 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 "testing/gtest/include/gtest/gtest.h" |
| 6 #include "../../../testing/fx_string_testhelpers.h" |
| 7 #include "../../include/fxcrt/fx_basic.h" |
| 8 |
| 9 #define ByteStringLiteral(str) CFX_ByteString(FX_BSTRC(str)) |
| 10 |
| 11 TEST(fxcrt, WideStringUTF16LE_Encode) { |
| 12 struct UTF16LEEncodeCase { |
| 13 CFX_WideString ws; |
| 14 CFX_ByteString bs; |
| 15 } utf16le_encode_cases[] = { |
| 16 { L"", ByteStringLiteral("\0\0") }, |
| 17 { L"abc", ByteStringLiteral("a\0b\0c\0\0\0") }, |
| 18 { L"abcdef", ByteStringLiteral("a\0b\0c\0d\0e\0f\0\0\0") }, |
| 19 { L"abc\0def", ByteStringLiteral("a\0b\0c\0\0\0") }, |
| 20 { L"\xaabb\xccdd", ByteStringLiteral("\xbb\xaa\xdd\xcc\0\0") }, |
| 21 { L"\x3132\x6162", ByteStringLiteral("\x32\x31\x62\x61\0\0") }, |
| 22 }; |
| 23 |
| 24 for (size_t i = 0; i < FX_ArraySize(utf16le_encode_cases); ++i) { |
| 25 EXPECT_EQ(utf16le_encode_cases[i].bs, |
| 26 utf16le_encode_cases[i].ws.UTF16LE_Encode()) |
| 27 << " for case number " << i; |
| 28 } |
| 29 } |
| OLD | NEW |