Example #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Test the character name at the memory address specified.
        /// Will assert an error if the PUA codepoint name and digit value are not correct.
        /// </summary>
        /// <param name="puaIndex">Unicode codepoint</param>
        /// <param name="digit">Expected correct PUA codepoint name</param>
        /// ------------------------------------------------------------------------------------
        public static void Check_PUA_Digit(int puaIndex, int digit)
        {
            string name     = "";
            int    icuDigit = -1;

            //Getting the character name at the memory address specified
            FwIcu.UErrorCode      error;
            FwIcu.UCharNameChoice choice = FwIcu.UCharNameChoice.U_UNICODE_CHAR_NAME;
            FwIcu.u_CharName(puaIndex, choice, out name, out error);
            // Radix means "base", so this will return the base 10 value of this digit.
            // (Note, the radix is just used to return an error if the digit isn't valid in the given radix)
            icuDigit = FwIcu.u_Digit(puaIndex, 10);

            //Check to make sure expected result is the same as actual result, if not, output error
            Assert.AreEqual(digit, icuDigit, "PUA Character " +
                            puaIndex.ToString("x", new System.Globalization.NumberFormatInfo()) +
                            " has an incorrect digit value");
        }