Chromium Code Reviews| 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 TEST(fxcrt, WideStringUTF16LE_Encode) { | |
| 10 CFX_WideString wide_strings[] = { | |
| 11 L"", | |
| 12 L"abc", | |
| 13 L"abcdef", | |
| 14 L"abc\0def", | |
| 15 L"23\0456", | |
|
Tom Sepez
2015/01/21 18:15:54
beware of tailing digits following a \0, the inten
Bo Xu
2015/01/21 19:23:55
Done.
| |
| 16 L"\x3132\x6162" // This is wrong? Endianness matters here? | |
|
Tom Sepez
2015/01/21 18:15:54
So, what you'd have here is a wide string:
U+313
Bo Xu
2015/01/21 19:23:55
Oh, right, i see.
| |
| 17 }; | |
| 18 CFX_ByteString byte_strings[] = { | |
|
Tom Sepez
2015/01/21 18:15:54
nit: its preferable to make a single array of stru
Bo Xu
2015/01/21 19:23:55
Done.
| |
| 19 CFX_ByteString(FX_BSTRC("\0\0")), | |
| 20 CFX_ByteString(FX_BSTRC("a\0b\0c\0\0\0")), | |
| 21 CFX_ByteString(FX_BSTRC("a\0b\0c\0d\0e\0f\0\0\0")), | |
| 22 CFX_ByteString(FX_BSTRC("a\0b\0c\0\0\0")), | |
| 23 CFX_ByteString(FX_BSTRC("\x32\x00\x33\x00\045\x00\x36\x00\x00\x00")), | |
| 24 CFX_ByteString(FX_BSTRC("12ab\0\0")) | |
| 25 }; | |
| 26 for (size_t i = 0; i < FX_ArraySize(wide_strings); ++i) { | |
| 27 EXPECT_EQ(byte_strings[i], wide_strings[i].UTF16LE_Encode()) | |
| 28 << " for case number " << i; | |
| 29 } | |
| 30 } | |
| OLD | NEW |