[cig-commits] r4883 - in long/3D/Gale/trunk/src/StGermain: . Discretisation/Geometry/tests

walter at geodynamics.org walter at geodynamics.org
Wed Oct 11 13:48:26 PDT 2006


Author: walter
Date: 2006-10-11 13:48:25 -0700 (Wed, 11 Oct 2006)
New Revision: 4883

Modified:
   long/3D/Gale/trunk/src/StGermain/
   long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testComplexMath.0of1.expected
   long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testComplexMath.c
Log:
 r2940 at earth:  boo | 2006-10-11 13:42:49 -0700
  r2856 at earth (orig r3844):  KathleenHumble | 2006-10-08 22:44:47 -0700
  rewriting section in testComplexMath.c 
  so that it tests for a tolerance
  and prints out an wxpected result.
  This should stop the test breaking because of
  varying output errors for numbers close to zero.
  
  
 



Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
   - 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2939
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3843
   + 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2940
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3844

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testComplexMath.0of1.expected
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testComplexMath.0of1.expected	2006-10-11 20:48:24 UTC (rev 4882)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testComplexMath.0of1.expected	2006-10-11 20:48:25 UTC (rev 4883)
@@ -28,7 +28,7 @@
 dest = 5.5000000 - 3.0000000 i
 dest = -0.1500000 + 0.3000000 i
 dest = -0.1333333 - 0.2666667 i
-dest = 1.0000000 + 0.0000000 i
+Answer within tolerance 1e-15 of 1.00000 + i 0.00000
 
 ----------------- Testing Conjugate -----------------
 x = 1.0000000 - 2.0000000 i

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testComplexMath.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testComplexMath.c	2006-10-11 20:48:24 UTC (rev 4882)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testComplexMath.c	2006-10-11 20:48:25 UTC (rev 4883)
@@ -42,6 +42,7 @@
 #define Journal_PrintCmplx( stream, self ) \
                 Journal_Printf( stream, #self " = %.7f %c %.7f i\n", (self)[ REAL_PART ], (self)[ IMAG_PART ] >= 0.0 ? '+' : '-', fabs( (self)[ IMAG_PART ] ) )
 
+#define TESTCOMPLEXMATH_TOL 1e-15
 
 int main( int argc, char* argv[] ) {
 	MPI_Comm CommWorld;
@@ -121,7 +122,19 @@
 		Cmplx_RealDivideByCmplx( y, 1.0, dest );
 		Journal_PrintCmplx( stream, dest );	
 		Cmplx_Multiply( y, dest, dest );
-		Journal_PrintCmplx( stream, dest );	
+		/* Test here for tolerances */
+		if (fabs(dest[IMAG_PART]) <= TESTCOMPLEXMATH_TOL ) {
+			Journal_Printf(stream, "Answer within tolerance %g of %.5f + i %.5f\n", 
+				TESTCOMPLEXMATH_TOL,
+				dest[REAL_PART],
+				0);
+		}
+		else{
+			Journal_Printf(stream, "Answer not within tolerance %g of %.5f + i %.5f\n", 
+				TESTCOMPLEXMATH_TOL,
+				1,
+				0);
+		}
 
 		Journal_Printf(stream, "\n----------------- Testing Conjugate -----------------\n" );
 		Cmplx_Conjugate( x, x );



More information about the cig-commits mailing list