daixyz-test.c:


/* daixyz-test.c 
 * © Copyright 1999 by John Halleck
 * All rights reserved.
 */
/* Version of May 10th, 2000 */

#include <stdio.h>
#include <math.h>

#include "errors.h"
#include "vec.h"
#include "vecdebug.h"
#include "mat.h"
#include "matdebug.h"
#include "survey3d.h"
#include "survey3debug.h"

#include "daixyz.h"

#include "reportframe.h"

double temp;

covariance datavariances;
dai data;
#define D data[0]
#define A data[1]
#define I data[2]

covariance finalvariances;
xyz result;

static double mag (vector x) {
 return sqrt(x[0]*x[0]+x[1]*x[1]+x[2]*x[2]);
}

static int testone (char *text, double d, double a, double i) {
int problem = 0;
printf ("\n\n%s\n", text);
D = d; A = a; I = i;
vecprint ("D, A, I:", 3, data);
covarprint ("DAI covariances:", datavariances);
if  ((problem = daixyz(result, finalvariances, data, datavariances))) {
   goterrorstat ("valid call rejected?", problem);
   return problem;
}
vecprint ("X, Y, Z:", 3, result);
printf ("Magnitude %f\n", mag(result));
covarprint ("XYZ covariances:", finalvariances);
detcvr (&temp, finalvariances);
printf ("Magnitude %f\n", temp);
return problem;
}



int main () {
double pi  = 3.14159265;
double angle0   = 0;
double angle45  = ( 45.0/180.0) * 3.14159265;
double angle90  = ( 90.0/180.0) * 3.14159265;
double angle135 = (135.0/180.0) * 3.14159265; 
double angle180 =                 3.14159265;
double angle225 = (225.0/180.0) * 3.14159265;
double angle270 = (270.0/180.0) * 3.14159265;
double angle315 = (315.0/180.0) * 3.14159265;
int problem;

inittests ("daixyz");
newtest ("daixyz");

if ((problem = cvrident (datavariances)))
   goterrorstat ("cvrident failed valid call?", problem);
X(datavariances) = 0.01;
Y(datavariances) = pi/180.0;
Z(datavariances) = pi/180.0;
covarprint ("Base data matrix =", datavariances);
detcvr (&temp, datavariances);
printf ("Magnitude = %f\n", temp);

D = 0.0; A = 0.0; I = 0.0; /* north */
if (ERRnumeric !=
      (problem = daixyz (result, finalvariances, data, datavariances))
   )
   goterrorstat ("accepted degenerate shot.", problem);

D = 10.0;
if ( ERRnil != (problem = daixyz(result, finalvariances, data,             0))
  || ERRnil != (problem = daixyz(result, finalvariances,    0, datavariances))
  || ERRnil != (problem = daixyz(result,              0, data, datavariances))
  || ERRnil != (problem = daixyz(     0, finalvariances, data, datavariances))
   ) 
   goterrorstat ("Didn't notice nil array pointer?",problem );

testone ("N",   10.0, angle0,   angle0);
testone ("NE",  10.0, angle45,  angle0);
testone (" E",  10.0, angle90,  angle0);
testone ("SE",  10.0, angle135, angle0);
testone ("S ",  10.0, angle180, angle0);
testone ("SW",  10.0, angle225, angle0);
testone (" W",  10.0, angle270, angle0);
testone ("NW",  10.0, angle315, angle0);

testone ("N UP",       10.0, angle0,  angle90);
testone ("N UP slope", 10.0, angle0,  angle45);
testone ("N level",    10.0, angle0,  angle0 );
testone ("N DN slope", 10.0, angle0, -angle45);
testone ("N DN",       10.0, angle0, -angle90);

testone ("E UP",       10.0, angle90,  angle90);
testone ("E UP slope", 10.0, angle90,  angle45); 
testone ("E level",    10.0, angle90,  angle0 );
testone ("E DN slope", 10.0, angle90, -angle45);
testone ("E DN",       10.0, angle90, -angle90);

testone ("NW UP slope", 10.0, angle45, angle45);

goterrorstat ("Further tests need to be written", ERRnotimplemented);

endtest();
finalizetests();
return progerrors;
}


Go to ...


This page is http://www.cc.utah.edu/~nahaj/cave/survey/code/c/daixyz-test.c.html
© Copyright 2000 by John Halleck, All Rights Reserved.
This snapshot was last modified on August 23rd, 2000
And the underlying file was last modified on May 11th, 2000