Co4239ctor_i.runTest C# (CSharp) Méthode

runTest() public méthode

public runTest ( ) : bool
Résultat bool
 public virtual bool runTest()
   {
   int iCountTestcases = 0;
   int iCountErrors = 0; 
   Console.Error.WriteLine( strName + ": " + strTest+ " runTest started..." );
   Random rdm = null;
   Random rdm2 = null;
   String strLoc = null;
   int retVal;
   try {
   iCountTestcases++;
   rdm = new Random (-4); strLoc = "L_fg265"; 
   iCountTestcases++;
   rdm = new Random (unchecked(Int32.MaxValue + 1)); strLoc = "L_tr309";
   iCountTestcases++;
   rdm = new Random (unchecked(Int32.MinValue - 1)); strLoc = "L_iu32";
   iCountTestcases++;
   rdm = new Random (unchecked((int)Int64.MaxValue + 1)); strLoc = "L_gf38";
   iCountTestcases++;
   rdm = new Random (unchecked((int)Int64.MinValue - 1));
   }
   catch (Exception ) { print (strLoc);}
   rdm = new Random(4); 
   for (int i = 0; i < 100; i++) {
   iCountTestcases++;
   retVal = rdm.Next();
   if ( retVal < 0 || retVal > Int32.MaxValue) {
   iCountErrors++;
   print ("E_gh46");
   }
   }
   rdm = new Random(4); 
   rdm2 = new Random(4); 
   for (int i = 0; i < 100; i++) {
   iCountTestcases++;
   if (rdm.Next() != rdm2.Next()) {
   iCountErrors++;
   print ("E_g32");
   }
   }
   if ( iCountErrors == 0 )
     {
     Console.Error.WriteLine( "paSs. " + strTest + "   iCountTestCases == " + iCountTestcases);
     return true;
     }
   else
     {
     Console.Error.WriteLine( "FAiL. " + strTest + "    iCountErrors==" + iCountErrors);
     return false;
     }
   }
 private void printexc(Exception exc)

Usage Example

Exemple #1
0
    public static void Main(String[] args)
    {
        bool         bResult = false;
        Co4239ctor_i oCbTest = new Co4239ctor_i();

        try
        {
            bResult = oCbTest.runTest();
        }
        catch (Exception ex)
        {
            bResult = false;
            Console.Error.Write(strTest);
            Console.Error.WriteLine(": Main() Uncaught exception");
            Console.Error.WriteLine(ex.ToString());
        }
        if (bResult == true)
        {
            Environment.ExitCode = 0;
        }
        else
        {
            Environment.ExitCode = 1;
        }
    }
All Usage Examples Of Co4239ctor_i::runTest