Co7084ctor_Int32_Int32_Int32_Boolean_Byte.runTest C# (CSharp) Method

runTest() public method

public runTest ( ) : bool
return bool
 public bool runTest()
   {
   Console.WriteLine(s_strTFPath + "\\" + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
   String strLoc = "Loc_000oo";
   String strValue = String.Empty;
   int iCountErrors = 0;
   int iCountTestcases = 0;
   try
     {
     Byte byScale;
     Int32 nHi,nMid,nLo;
     Boolean bIsNeg;
     Decimal dRet;
     Random rand = new Random ();
     Int32 [] iRets;
     Int32 nLastBit;
     strLoc = "Loc_498yg";
     iCountTestcases += 1;
     nLo = 0;
     nMid = 0;
     nHi = 0;
     bIsNeg = true;
     byScale = 20;
     dRet = new Decimal (nLo,nMid,nHi,bIsNeg,byScale);
     if (dRet != 0)
       {
       iCountErrors += 1;
       printerr ( "Error_323sc! Send in==(" + nLo.ToString() + "," + nMid.ToString() + "," + nHi.ToString() + "," + bIsNeg.ToString() + "," + byScale.ToString() + ") Expected==0 Value==" + dRet.ToString());
       }
     strLoc = "Loc_233fd";
     iCountTestcases += 1;
     nLo = unchecked ((int)4294967295);
     nMid = unchecked ((int)4294967295);
     nHi = unchecked ((int)4294967295);
     bIsNeg = false;
     byScale = 0;
     dRet = new Decimal (nLo,nMid,nHi,bIsNeg,byScale);
     if (!dRet.Equals(Decimal.MaxValue))
       {
       iCountErrors += 1;
       printerr ( "Error_763cd! Send in==(" + nLo.ToString() + "," + nMid.ToString() + "," + nHi.ToString() + "," + bIsNeg.ToString() + "," + byScale.ToString() + ") Expected==79228162514264337593543950335 Value==" + dRet.ToString());
       }
     strLoc = "Loc_893ko";
     iCountTestcases += 1;
     nLo = unchecked ((int)4294967295);
     nMid = unchecked ((int)4294967295);
     nHi = unchecked ((int)4294967295);
     bIsNeg = true;
     byScale = 0;
     dRet = new Decimal (nLo,nMid,nHi,bIsNeg,byScale);
     if (!dRet.Equals(Decimal.MinValue))
       {
       iCountErrors += 1;
       printerr ( "Error_168jk! Send in==(" + nLo.ToString() + "," + nMid.ToString() + "," + nHi.ToString() + "," + bIsNeg.ToString() + "," + byScale.ToString() + ") Expected==79228162514264337593543950335 Value==" + dRet.ToString());
       }
     strLoc = "Loc_486nj";
     for (int count = 0 ; count < 1000 ; count++)
       {
       iCountTestcases++;
       nLo = rand.Next(0, Int32.MaxValue);
       nMid = rand.Next(0, Int32.MaxValue);
       nHi = rand.Next(0, Int32.MaxValue);
       bIsNeg = Convert.ToBoolean (rand.Next(0, 2));
       byScale = (Byte) rand.Next(0, 28);
       dRet = new Decimal (nLo,nMid,nHi,bIsNeg,byScale);
       iRets = Decimal.GetBits (dRet);
       nLastBit = ((((IConvertible)bIsNeg).ToInt32(null)) << 31) | ((((IConvertible)byScale).ToInt32(null)) << 16);
       if ((nLo != iRets [0]) || (nMid != iRets [1]) || (nHi != iRets [2]) || (nLastBit != iRets[3]  ))
	 {
	 iCountErrors += 1;
	 printerr ( "Error_452ds_" + count + "! Send in==(" + nLo.ToString() + "," + nMid.ToString() + "," + nHi.ToString() + "," + bIsNeg.ToString() + "," + byScale.ToString() + ") Expected==79228162514264337593543950335 Value==" + dRet.ToString());
	 } 
       }
     strLoc = "Loc_481kd";
     iCountTestcases++;
     nLo = unchecked (20);
     nMid = unchecked (5);
     nHi = unchecked (9000);
     bIsNeg = true;
     byScale = 29;
     try
       {
       dRet = new Decimal (nLo,nMid,nHi,bIsNeg,byScale);
       iCountErrors++;
       printerr( "Error_812jc! no exception thrown");
       }
     catch (ArgumentOutOfRangeException)
       {
       printinfo( "Info_932ds! Caught ArgumentOutOfRangeException");
       }
     catch (Exception e)
       {
       ++iCountErrors;	
       printerr( "Error_001cs! Wrong exception thrown: " + e.ToString());
       }
     } catch (Exception exc_general ) {
     ++iCountErrors;
     Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general=="+exc_general.ToString());
     }
   if ( iCountErrors == 0 )
     {
     Console.WriteLine( "paSs. "+s_strTFName+" ,iCountTestcases=="+iCountTestcases.ToString());
     return true;
     }
   else
     {
     Console.WriteLine("FAiL! "+s_strTFName+" ,inCountErrors=="+iCountErrors.ToString()+" , BugNums?: "+s_strActiveBugNums );
     return false;
     }
   }
 public void printerr ( String err )

Usage Example

    public static void Main(String[] args)
    {
        bool bResult = false;
        Co7084ctor_Int32_Int32_Int32_Boolean_Byte cbA = new Co7084ctor_Int32_Int32_Int32_Boolean_Byte();

        try {
            bResult = cbA.runTest();
        } catch (Exception exc_main) {
            bResult = false;
            Console.WriteLine(s_strTFAbbrev + " : FAiL! Error Err_9999zzz! Uncaught Exception in main(), exc_main==" + exc_main.ToString());
        }
        if (!bResult)
        {
            Console.WriteLine("Path: " + s_strTFPath + "\\" + s_strTFName);
            Console.WriteLine(" ");
            Console.WriteLine("FAiL!  " + s_strTFAbbrev);
            Console.WriteLine(" ");
        }
        if (bResult)
        {
            Environment.ExitCode = 0;
        }
        else
        {
            Environment.ExitCode = 1;
        }
    }
All Usage Examples Of Co7084ctor_Int32_Int32_Int32_Boolean_Byte::runTest
Co7084ctor_Int32_Int32_Int32_Boolean_Byte