Co4077Sin.runTest C# (CSharp) Method

runTest() public method

public runTest ( ) : bool
return bool
 public virtual bool runTest()
   {
   Console.Out.WriteLine( "Co4077Sin.cs  runTest() started." );
   StringBuilder sblMsg = new StringBuilder( 99 );
   int iCountErrors = 0;
   int iCountTestcases = 0;
   double dubExpected = 0;
   double dubEquation = 0;
   double dubOne = 0;
   double dubTwo = 0;
   do
     {
     try
       {
       dubExpected = 0.5;  
       dubOne = ( dubExpected - 0.1 );
       dubTwo = ( dubExpected + 0.1 );
       dubEquation = Math.Sin( Math.PI/6 );
       ++iCountTestcases;
       if ( ( dubOne <= dubEquation && dubEquation <= dubTwo ) == false )
	 {
	 ++iCountErrors;
	 sblMsg.Append( "POINTTOBREAK: find E_s90h, Sin not equal to expected value" );
	 Console.Error.WriteLine( sblMsg.ToString() );
	 break;
	 }
       dubExpected = 1.0;  
       dubOne = ( dubExpected - 0.1 );
       dubTwo = ( dubExpected + 0.1 );
       dubEquation = Math.Sin( Math.PI/2 );
       ++iCountTestcases;
       if ( ( dubOne <= dubEquation && dubEquation <= dubTwo ) == false )
	 {
	 ++iCountErrors;
	 sblMsg.Append( "POINTTOBREAK: find E_f32f, Sin not equal to expected value" );
	 Console.Error.WriteLine( sblMsg.ToString() );
	 break;
	 }
       dubExpected = 0.0;  
       dubOne = ( dubExpected - 0.01 );
       dubTwo = ( dubExpected + 0.01 );
       dubEquation = Math.Sin( 0 );
       ++iCountTestcases;
       if ( ( dubOne <= dubEquation && dubEquation <= dubTwo ) == false )	
	 {
	 ++iCountErrors;
	 sblMsg.Append( "POINTTOBREAK: find E_c93h, Sin not equal to expected value" );
	 Console.Error.WriteLine( sblMsg.ToString() );
	 break;
	 }
       dubExpected = 0.7;  
       dubOne = ( dubExpected - 0.1 );
       dubTwo = ( dubExpected + 0.1 );
       dubEquation = Math.Sin( Math.PI/4 );
       ++iCountTestcases;
       if ( ( dubOne <= dubEquation && dubEquation <= dubTwo ) == false )
	 {
	 ++iCountErrors;
	 sblMsg.Append( "POINTTOBREAK: find E_c93h, Sin not equal to expected value" );
	 Console.Error.WriteLine( sblMsg.ToString() );
	 break;
	 }
       dubExpected = 0.86;  
       dubOne = ( dubExpected - 0.1 );
       dubTwo = ( dubExpected + 0.1 );
       dubEquation = Math.Sin( Math.PI/3 );
       ++iCountTestcases;
       if ( ( dubOne <= dubEquation && dubEquation <= dubTwo ) == false )
	 {
	 ++iCountErrors;
	 sblMsg.Append( "POINTTOBREAK: find E_c93h, Sin not equal to expected value" );
	 Console.Error.WriteLine( sblMsg.ToString() );
	 break;
	 }
       }
     catch ( Exception Exc )
       {
       ++iCountErrors;
       sblMsg.Length =  99 ;
       sblMsg.Append( "POINTTOBREAK: find E_f3h5, Generic Exception Caught, Exc.ToString() == " );
       sblMsg.Append( Exc.ToString() );
       Console.Error.WriteLine( sblMsg.ToString() );
       break;
       }
     }
   while ( false );
   if ( iCountErrors == 0 )
     {
     Console.Error.Write( "Math\\Co4077Sin.cs: paSs.  iCountTestcases==" );
     Console.Error.WriteLine( iCountTestcases );
     return true;
     }
   else
     {
     Console.Error.Write( "Co4077Sin.cs iCountErrors==" );
     Console.Error.WriteLine( iCountErrors );
     Console.Error.WriteLine(  "Co4077Sin.cs   FAiL !"  );
     return false;
     }
   }
 public static void Main( String[] args )

Usage Example

Esempio n. 1
0
    public static void Main(String[] args)
    {
        bool          bResult = false;
        StringBuilder sblW    = null;
        Co4077Sin     cbA     = new Co4077Sin();

        try
        {
            bResult = cbA.runTest();
        }
        catch (Exception exc)
        {
            bResult = false;
            Console.Error.WriteLine("Co4077Sin.cs");
            sblW = new StringBuilder("EXTENDEDINFO: (E_999zzz) ");
            sblW.Append(exc.ToString());
            Console.Error.WriteLine(sblW.ToString());
        }
        if (bResult == true)
        {
            Environment.ExitCode = 0;
        }
        else
        {
            Environment.ExitCode = 1;
        }
    }
All Usage Examples Of Co4077Sin::runTest