34 ui(
new Ui::rearth_test)
37 QListWidget *testlist =
ui->TestList;
41 double lat, radFunction, radCorrect,
delta, minDelta, minDeltaRadius, maxDelta, maxDeltaRadius, averageDelta=0.0, averageRadius;
42 fscanf(LATvRdata,
"%d", &numTests);
44 for (i=0; i<numTests; i++) {
45 fscanf(LATvRdata,
"%lf%lf", &lat, &radCorrect);
47 delta = radFunction-radCorrect;
48 averageDelta +=
delta;
49 averageRadius +=radCorrect;
51 maxDelta = minDelta =
delta;
52 maxDeltaRadius = minDeltaRadius = radCorrect;
54 }
else if (fabs(delta)>fabs(maxDelta)) {
56 maxDeltaRadius = radCorrect;
58 }
else if (fabs(delta)<fabs(minDelta)) {
60 minDeltaRadius = radCorrect;
63 QListWidgetItem *newTest =
new QListWidgetItem(QString(
"lat: %1°, rearth: %2, correct: %3, delta: %4").arg(
DEGOF(lat)).arg(radFunction).arg(radCorrect).arg(delta), testlist);
64 QVariant latitude(lat);
65 newTest->setData(Qt::UserRole, latitude);
66 QVariant functionOut(radFunction);
67 newTest->setData(Qt::UserRole+1, functionOut);
68 QVariant correct(radCorrect);
69 newTest->setData(Qt::UserRole+2, correct);
70 QVariant error(delta);
71 newTest->setData(Qt::UserRole+3, error);
75 parent->
setError((minDelta*100)/minDeltaRadius, (maxDelta*100)/maxDeltaRadius, (averageDelta*100)/averageRadius);
76 averageDelta /= numTests;
77 averageRadius /= numTests;
78 ui->TestCount->setText(QString(
"%1 Tests:").arg(numTests));
80 testlist->item(
MaxErrIndex)->setBackground(Qt::red);
81 testlist->item(
MinErrIndex)->setBackground(Qt::darkGreen);
int MaxErrIndex
Definition: rearth_test.h:59
static double delta
Definition: agent_exec-2-0.cpp:141
int i
Definition: rw_test.cpp:37
static int openFileLine(FILE **fp, const char filename[], int startLine)
Definition: testcontainer.cpp:155
void setError(double min, double max, double avg)
Definition: testcontainer.cpp:114
#define DEGOF(rad)
Degrees of a Radian value.
Definition: math/constants.h:33
int MinErrIndex
Definition: rearth_test.h:60
static void skipLines(FILE *fp, int lines)
Definition: testcontainer.cpp:144
double rearth(double lat)
Definition: convertlib.cpp:1556
Ui::rearth_test * ui
Definition: rearth_test.h:57