Skip to content

Commit

Permalink
add unit tests: TestUtf16::test_fromCodePoints and Test Utf8::test_fr…
Browse files Browse the repository at this point in the history
…omCodePoints
  • Loading branch information
mandel59 committed Jul 12, 2014
1 parent 7effc48 commit 28d3a5a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/TestUtf16.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
9 changes: 9 additions & 0 deletions test/TestUtf8.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down

0 comments on commit 28d3a5a

Please sign in to comment.