Ejemplo n.º 1
0
        public void TestRoundTrip()
        {
            int  options = Normalizer.IGNORE_HANGUL;
            bool compat  = false;

            ComposedCharIter iter = new ComposedCharIter(false, options);

            while (iter.HasNext)
            {
                char ch = iter.Next();

                string chStr  = "" + ch;
                string decomp = iter.Decomposition();
                string comp   = Normalizer.Compose(decomp, compat);

                if (UChar.HasBinaryProperty(ch, UProperty.Full_Composition_Exclusion))
                {
                    Logln("Skipped excluded char " + Hex(ch) + " (" + UChar.GetName(ch) + ")");
                    continue;
                }

                // Avoid disparaged characters
                if (decomp.Length == 4)
                {
                    continue;
                }

                if (!comp.Equals(chStr))
                {
                    Errln("ERROR: Round trip invalid: " + Hex(chStr) + " --> " + Hex(decomp)
                          + " --> " + Hex(comp));

                    Errln("  char decomp is '" + decomp + "'");
                }
            }
        }