|
|
|
@ -3,45 +3,43 @@
|
|
|
|
|
#include <wchar.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TEST(PlStringTest,ToUtf16) |
|
|
|
|
{ |
|
|
|
|
uint16_t text[] = {0x0061,0x0062,0x0063,0x0064}; |
|
|
|
|
plStringBuffer<uint16_t> expected = plStringBuffer<uint16_t>(text,4); |
|
|
|
|
plStringBuffer<uint16_t> output = plString("abcd").ToUtf16(); |
|
|
|
|
|
|
|
|
|
const uint16_t* c = output.GetData(); |
|
|
|
|
const uint16_t* d = expected.GetData(); |
|
|
|
|
printf("expected size %d output size %d\n",expected.GetSize(),output.GetSize()); |
|
|
|
|
for(int i=0;i<expected.GetSize();i++) |
|
|
|
|
{ |
|
|
|
|
printf("%u %s \n",c,c); |
|
|
|
|
printf("%u %s \n",d,d); |
|
|
|
|
c++; |
|
|
|
|
d++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST(PlStringTest,ToWchar) |
|
|
|
|
{ |
|
|
|
|
wchar_t text[] =L"abcdé"; |
|
|
|
|
plStringBuffer<wchar_t> expected = plStringBuffer<wchar_t>(text,sizeof(text)); |
|
|
|
|
plStringBuffer<wchar_t> output = plString("abcdé").ToWchar(); |
|
|
|
|
const wchar_t* outputStr = output.GetData(); |
|
|
|
|
const wchar_t* expectedStr = expected.GetData(); |
|
|
|
|
EXPECT_STREQ(expectedStr,outputStr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//TEST(PlStringTest,ToUtf16)
|
|
|
|
|
//{
|
|
|
|
|
// uint16_t text[] = {4278124641,4278124776,4278125475,4278136649};
|
|
|
|
|
// plStringBuffer<uint16_t> expected = plStringBuffer<uint16_t>(text,4);
|
|
|
|
|
// plStringBuffer<uint16_t> output = plString("abcd").ToUtf16();
|
|
|
|
|
//
|
|
|
|
|
// const uint16_t* c = output.GetData();
|
|
|
|
|
// const uint16_t* d = expected.GetData();
|
|
|
|
|
// printf("expected size %d output size %d\n",expected.GetSize(),output.GetSize());
|
|
|
|
|
// for(int i=0;i<expected.GetSize();i++)
|
|
|
|
|
// {
|
|
|
|
|
// printf("%u %s \n",c,c);
|
|
|
|
|
// printf("%u %s \n",d,d);
|
|
|
|
|
// c++;
|
|
|
|
|
// d++;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//TEST(PlStringTest,ToWchar)
|
|
|
|
|
//{
|
|
|
|
|
// wchar_t text[] =L"abcdé";
|
|
|
|
|
// plStringBuffer<wchar_t> expected = plStringBuffer<wchar_t>(text,sizeof(text));
|
|
|
|
|
// plStringBuffer<wchar_t> output = plString("abcdé").ToWchar();
|
|
|
|
|
// const wchar_t* outputStr = output.GetData();
|
|
|
|
|
// const wchar_t* expectedStr = expected.GetData();
|
|
|
|
|
// EXPECT_STREQ(expectedStr,outputStr);
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//TEST(PlStringTest,ToIso8859_1)
|
|
|
|
|
//{
|
|
|
|
|
// char text[] ="abcde";
|
|
|
|
|
// plStringBuffer<char> expected = plStringBuffer<char>(text,sizeof(text));
|
|
|
|
|
// plStringBuffer<char> output = plString("abcde").ToIso8859_1();
|
|
|
|
|
// const char* outputStr = output.GetData();
|
|
|
|
|
// const char* expectedStr = expected.GetData();
|
|
|
|
|
// EXPECT_STREQ(expectedStr,outputStr);
|
|
|
|
|
//}
|
|
|
|
|
TEST(PlStringTest,ToIso8859_1) |
|
|
|
|
{ |
|
|
|
|
char text[] ="abcde"; |
|
|
|
|
plStringBuffer<char> expected = plStringBuffer<char>(text,sizeof(text)); |
|
|
|
|
plStringBuffer<char> output = plString("abcde").ToIso8859_1(); |
|
|
|
|
const char* outputStr = output.GetData(); |
|
|
|
|
const char* expectedStr = expected.GetData(); |
|
|
|
|
EXPECT_STREQ(expectedStr,outputStr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST(PlStringTest,Format) |
|
|
|
|
{ |
|
|
|
|