/* vecdebug-test.c test routines for the vector 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 "vec.h" /* Vector specific stuff */ #include "vecdebug.h" /* Matrix debugging help */ #include "reportframe.h" /* Standard testing output form */ #define FUDGE (1.0 / 1000000.0) /* Fudge value for the near equality tests */ #define ARRAYSIZE 8 /* How big an array do we need to test? (At least 3) */ double test1[ARRAYSIZE], test2[ARRAYSIZE]; /* Vectors to test with. */ /* Report an error */ static error haserrorstat (char *reason, error problem) { error result; result = goterrorstat (reason, problem); if (problem == ERRfalse) { result = vecprint ("test1: ", 9, test1); if (result) return result; result = vecprint ("test2: ", 9, test2); if (result) return result; } return result; } int main (argc, argv) int argc; char argv[]; { error problem = NoError; int i; /* Loop index */ double temp; inittests("vecdebug"); /* ---------------------------------------------------------------- */ newsection ("print routine interfaces"); newtest("vecprint"); if (ERRsize != (problem = vecprint ("... Vector size test", 0, test1)) ) goterrorstat ("zero length vector passed", problem); if (ERRnil != (problem = vecprint ("... Nil vector test", ARRAYSIZE, 0)) ) goterrorstat ("nil vector pointer passed", problem); for (i=0; i