Added Unicode Strings test (#728)

This commit is contained in:
rodolphito 2019-04-05 09:12:28 -07:00 committed by vis2k
parent fdd35bc840
commit 0d2f64228c

View File

@ -57,6 +57,45 @@ public void TestToArray()
Assert.That(writer.ToArray().Length, Is.EqualTo(2));
}
[Test]
public void TestUnicodeString()
{
string[] weirdUnicode = new string[]{
"𝔲𝔫𝔦𝔠𝔬𝔡𝔢 𝔱𝔢𝔰𝔱",
"𝖚𝖓𝖎𝖈𝖔𝖉𝖊 𝖙𝖊𝖘𝖙",
"𝐮𝐧𝐢𝐜𝐨𝐝𝐞 𝐭𝐞𝐬𝐭",
"𝘶𝘯𝘪𝘤𝘰𝘥𝘦 𝘵𝘦𝘴𝘵",
"𝙪𝙣𝙞𝙘𝙤𝙙𝙚 𝙩𝙚𝙨𝙩",
"𝚞𝚗𝚒𝚌𝚘𝚍𝚎 𝚝𝚎𝚜𝚝",
"𝓊𝓃𝒾𝒸𝑜𝒹𝑒 𝓉𝑒𝓈𝓉",
"𝓾𝓷𝓲𝓬𝓸𝓭𝓮 𝓽𝓮𝓼𝓽",
"𝕦𝕟𝕚𝕔𝕠𝕕𝕖 𝕥𝕖𝕤𝕥",
"ЦПIᄃӨDΣ ƬΣƧƬ",
"ㄩ几丨匚ㄖᗪ乇 ㄒ乇丂ㄒ",
"ひ刀ノᄃのり乇 イ乇丂イ",
"Ʉ₦ł₵ØĐɆ ₮Ɇ₴₮",
" ",
"ᴜɴɪᴄᴏᴅᴇ ᴛᴇꜱᴛ",
"ʇsǝʇ ǝpoɔıun",
"ยภเς๏๔є ՇєรՇ",
"ᑘᘉᓰᑢᓍᕲᘿ ᖶᘿSᖶ",
"υɳιƈσԃҽ ƚҽʂƚ",
"ʊռɨƈօɖɛ ȶɛֆȶ",
"🆄🅽🅸🅲🅾🅳🅴 🆃🅴🆂🆃",
"ⓤⓝⓘⓒⓞⓓⓔ ⓣⓔⓢⓣ",
"̶̝̳̥͈͖̝͌̈͛̽͊̏̚͠",
};
foreach (string weird in weirdUnicode)
{
NetworkWriter writer = new NetworkWriter();
writer.Write(weird);
byte[] data = writer.ToArray();
NetworkReader reader = new NetworkReader(data);
string str = reader.ReadString();
Assert.That(str, Is.EqualTo(weird));
}
}
[Test]
public void TestPackedUInt32()
{