public void TestNormalizerAPI() { // instantiate a Normalizer from a CharacterIterator string s = Utility.Unescape("a\u0308\uac00\\U0002f800"); // make s a bit longer and more interesting CharacterIterator iter = new StringCharacterIterator(s + s); //test deprecated constructors Normalizer norm = new Normalizer(iter, NormalizerMode.NFC, 0); if (norm.Next() != 0xe4) { Errln("error in Normalizer(CharacterIterator).next()"); } Normalizer norm2 = new Normalizer(s, NormalizerMode.NFC, 0); if (norm2.Next() != 0xe4) { Errln("error in Normalizer(CharacterIterator).next()"); } // test clone(), ==, and hashCode() Normalizer clone = (Normalizer)norm.Clone(); if (clone.GetBeginIndex() != norm.GetBeginIndex()) { Errln("error in Normalizer.getBeginIndex()"); } if (clone.GetEndIndex() != norm.GetEndIndex()) { Errln("error in Normalizer.getEndIndex()"); } // test setOption() and getOption() clone.SetOption(0xaa0000, true); clone.SetOption(0x20000, false); if (clone.GetOption(0x880000) == 0 || clone.GetOption(0x20000) == 1) { Errln("error in Normalizer::setOption() or Normalizer::getOption()"); } // ICU4N specific - test setting normalizer options via enum clone.UnicodeVersion = NormalizerUnicodeVersion.Unicode3_2; assertEquals("error in Normalizer.UnicodeVersion property", NormalizerUnicodeVersion.Unicode3_2, clone.UnicodeVersion); clone.UnicodeVersion = NormalizerUnicodeVersion.Default; assertEquals("error in Normalizer.UnicodeVersion property", NormalizerUnicodeVersion.Default, clone.UnicodeVersion); //test deprecated normalize method Normalizer.Normalize(s, NormalizerMode.NFC, 0); //test deprecated compose method Normalizer.Compose(s, false, 0); //test deprecated decompose method Normalizer.Decompose(s, false, 0); }