/* survey3debug-test.c test routines for the mat package. * (C) Copyright 1999 by John Halleck * All rights reserved. */ /* Version of August 14th, 1999 */ #include /* Standard IO */ #include "errors.h" /* Common error codes */ #include "survey3d.h" /* 3dsurvey matrix specific stuff */ #include "survey3debug.h" /* Matrix debugging help */ #include "reportframe.h" /* Standard form for test results */ #define FUDGE (1.0 / 1000000.0) /* Fudge value for the near equality tests */ double test1[1][1]; double test5[5][5]; double R[4][2], A[4][3], B[3][2], BT[2][3]; double TR[4][2], TA[4][3], TB[3][2], TBT[2][3]; double TT[4][2]; int loopfail; int main (argc, argv) int argc; char argv[]; { error problem; coordinate coord; /* For coordinate tests */ weight newweight; covariance newcovar; inittests ("survey3debug"); /* ========================== internal routine tests ======================== */ newsection ("Print interfaces"); /* ------------- Coordinate test ------------ */ newtest ("coordprint"); if (ERRnil != (problem = coordprint (0, 0)) ) goterrorstat ("Nil pointer accepted", problem); coord[0] = 1.0; coord[1] = 2.0; coord[2] = 3.0; if ((problem = coordprint ("This should be the column vector 1 2 3", coord))) goterrorstat ("Valid call rejected", problem); endtest(); /* ----------- Weight print ----------- */ newtest("weightprint"); newweight[0] = 100.0; newweight[1] = 101.0; newweight[2] = 102.0; newweight[3] = 111.0; newweight[4] = 112.0; newweight[5] = 122.0; if (ERRnil != (problem = weightprint (0, 0)) ) goterrorstat ("Accepted nil pointer?", problem); if ((problem = weightprint("Symmetric matrix with value = coordinates+100.0", newweight))) goterrorstat ("Rejected valid call?", problem); endtest(); /* ----------- covariance print ------------- */ newtest("covarprint"); newcovar[0] = 100.0; newcovar[1] = 101.0; newcovar[2] = 102.0; newcovar[3] = 111.0; newcovar[4] = 112.0; newcovar[5] = 122.0; if (ERRnil != (problem = covarprint (0, 0)) ) goterrorstat ("Accepted nil pointer?", problem); if ((problem = covarprint("Symmetric matrix with value = coordinates+100.0", newcovar))) goterrorstat ("Rejected valid call?", problem); endtest(); endsection (); /* -------------------------------------------------------------------------- */ finalizetests(); return progerrors; }