Test Unicode/code point methods
()
| 714 | |
| 715 | /** Test Unicode/code point methods */ |
| 716 | @Test |
| 717 | public void unicodeTest () { |
| 718 | CharArray array = new CharArray(); |
| 719 | |
| 720 | // Append code point (emoji) |
| 721 | int smiley = 0x1F600; // 😀 |
| 722 | array.appendCodePoint(smiley); |
| 723 | Assert.assertEquals(2, array.size); // Surrogate pair |
| 724 | |
| 725 | // Code point at |
| 726 | int cp = array.codePointAt(0); |
| 727 | Assert.assertEquals(smiley, cp); |
| 728 | |
| 729 | // Code point count |
| 730 | array.append("Hello"); |
| 731 | int count = array.codePointCount(0, array.size); |
| 732 | Assert.assertEquals(6, count); // 1 emoji + 5 chars |
| 733 | |
| 734 | // Reverse with code points |
| 735 | CharArray array2 = new CharArray(); |
| 736 | array2.appendCodePoint(0x1F600); // 😀 |
| 737 | array2.append("Hi"); |
| 738 | array2.reverseCodePoints(); |
| 739 | Assert.assertEquals("iH", array2.substring(0, 2)); |
| 740 | } |
| 741 | |
| 742 | /** Test iterator methods */ |
| 743 | @Test |
nothing calls this directly
no test coverage detected