IsSymbol_char.runTest C# (CSharp) Method

runTest() public method

public runTest ( ) : bool
return bool
 public virtual bool runTest()
   {
   IList charData;          
   int iCountErrors = 0;
   int iCountTestcases = 0;
   charData = m_CharData.GetValueList();
   for (int iCurChar = 0; iCurChar < m_CharData.Count; iCurChar++)
     {
     CharInfo curCharInfo;    
     curCharInfo = (CharInfo) charData[iCurChar];
     if ( (curCharInfo.eCategory == UnicodeCategory.MathSymbol) ||
	  (curCharInfo.eCategory == UnicodeCategory.CurrencySymbol) ||
	  (curCharInfo.eCategory == UnicodeCategory.ModifierSymbol) ||
	  (curCharInfo.eCategory == UnicodeCategory.OtherSymbol) )
       {
       iCountTestcases++ ;
       if ( Char.IsSymbol(curCharInfo.chChar) )
	 {                    
	 Console.WriteLine("Passed :: " + 
			   "Categories match for char '" + 
			   ((int)(curCharInfo.chChar)).ToString("x4") + 
			   "' at position " + iCurChar.ToString("d3") + " Category :: " + 
			   curCharInfo.eCategory);
	 }
       else
	 {
	 iCountErrors++ ;
	 Console.WriteLine("Failed :: " +
			   "Category mismatch for char '0x" + 
			   ((int)(curCharInfo.chChar)).ToString("x4") + 
			   "' at position " + iCurChar.ToString("d3") + 
			   " UCD  Category : " + curCharInfo.eCategory + 
			   " NLS+ Category : " + 
			   Char.IsSymbol(curCharInfo.chChar) );
	 }
       }         
     }
   if ( iCountErrors == 0 ){
   Console.Error.Write( "Char_IsSymbol_char: paSs. iCountTestcases== " + iCountTestcases.ToString("d3"));
   return true;
   }
   else{
   Console.Error.Write( "Char_IsSymbol_char: Fail. iCountErrors== " + iCountErrors.ToString("d3"));
   return false;
   }
   }
 protected UnicodeCategory TranslateUnicodeCategory(string strCatAbbrev) 

Usage Example

    public static void Main(String[] strArgList)
    {
        bool bResult = false;
        bool bDataOK;

        try
        {
            IsSymbol_char ObjIsSymbol_char = new IsSymbol_char();
            bDataOK = ObjIsSymbol_char.ReadUnicodeData();
            if (!bDataOK)
            {
                Console.WriteLine("Not able to read the UniCode data from the file");
                return;
            }
            bResult = ObjIsSymbol_char.runTest();
        }
        catch (Exception exc)
        {
            bResult = false;
            Console.Error.WriteLine("IsSymbol_char main caught an Exception!" + exc.ToString());
            Console.Error.WriteLine(exc.ToString());
        }
        if (bResult == true)
        {
            Environment.ExitCode = 0;
        }
        else
        {
            Environment.ExitCode = 1;
        }
    }
All Usage Examples Of IsSymbol_char::runTest