diff --git a/test/TestUtf16.hx b/test/TestUtf16.hx index 796468c..4f5f9e4 100644 --- a/test/TestUtf16.hx +++ b/test/TestUtf16.hx @@ -21,6 +21,15 @@ class TestUtf16 extends haxe.unit.TestCase { assertEquals("a".code, u.codePointAt(4)); } + public function test_fromCodePoints() { + var u = Utf16.fromCodePoints([ + "𩸽".code, "あ".code, "ë".code, "a".code]); + assertEquals("𩸽".code, u.codePointAt(0)); + assertEquals("あ".code, u.codePointAt(2)); + assertEquals("ë".code, u.codePointAt(3)); + assertEquals("a".code, u.codePointAt(4)); + } + public function test_toString() { var u = Utf16.fromArray([0xD867, 0xDE3D, 0x3042, 0xEB, 0x61]); assertEquals("𩸽あëa", u.toString()); diff --git a/test/TestUtf8.hx b/test/TestUtf8.hx index 43c85e1..d3384fe 100644 --- a/test/TestUtf8.hx +++ b/test/TestUtf8.hx @@ -16,6 +16,15 @@ class TestUtf8 extends haxe.unit.TestCase { assertEquals("a".code, u.codePointAt(9)); } + public function test_fromCodePoints() { + var u = Utf8.fromCodePoints([ + "𩸽".code, "あ".code, "ë".code, "a".code]); + assertEquals("𩸽".code, u.codePointAt(0)); + assertEquals("あ".code, u.codePointAt(4)); + assertEquals("ë".code, u.codePointAt(7)); + assertEquals("a".code, u.codePointAt(9)); + } + public function test_toString() { var buf = new BytesBuffer(); for (x in [0xf0, 0xa9, 0xb8, 0xbd, 0xe3, 0x81, 0x82, 0xc3, 0xab, 0x61]) {