mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
.autotest
git-svn-id: svn://ultimatepp.org/upp/trunk@11268 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
474489cbf5
commit
ecf68362c0
2 changed files with 52 additions and 0 deletions
41
autotest/JsonEmoticon/JsonEmoticon.cpp
Normal file
41
autotest/JsonEmoticon/JsonEmoticon.cpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
dword emoticon = 0x1f60d; // Smiling Face With Heart-shaped Eyes
|
||||
|
||||
String text = "Český 아침글";
|
||||
Vector<dword> h = ToUtf32(text);
|
||||
h.Add('\n');
|
||||
h.Add(emoticon);
|
||||
h.Add(31);
|
||||
DUMP(h);
|
||||
|
||||
dword ref[] = { 268, 101, 115, 107, 253, 32, 50500, 52840, 44544, 10, 128525, 31 };
|
||||
|
||||
ASSERT(__countof(ref) == h.GetCount());
|
||||
|
||||
for(int i = 0; i < h.GetCount(); i++)
|
||||
ASSERT(h[i] == ref[i]);
|
||||
|
||||
text = ToUtf8(h);
|
||||
|
||||
String json = AsJSON(text);
|
||||
|
||||
DUMP(json);
|
||||
|
||||
ASSERT(json == "\"Český 아침글\\n\\uD83D\\uDE0D\\u001F\"");
|
||||
|
||||
String text2 = ParseJSON(json);
|
||||
|
||||
DUMP(text2);
|
||||
|
||||
ASSERT(text2 == text);
|
||||
ASSERT(ToUtf32(text2) == h);
|
||||
|
||||
LOG("=================== OK");
|
||||
}
|
||||
11
autotest/JsonEmoticon/JsonEmoticon.upp
Normal file
11
autotest/JsonEmoticon/JsonEmoticon.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
description "Testing surrogate pairs in JSON\377";
|
||||
|
||||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
JsonEmoticon.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue