50 int getSetTest(
void );
51 int equalityTest(
void );
52 int nonEqualityTest(
void );
53 int validTest(
void );
54 int exceptionTest(
void );
64 TUDEF(
"IonoModel",
"get and set" );
66 const double a[4] = {1.,2.,3.,4.};
67 const double b[4] = {5.,6.,7.,8.};
70 double gotA[4] = {0.,0.,0.,0.};
71 double gotB[4] = {0.,0.,0.,0.};
75 bool unsetResult = model.
getModel(gotA, gotB);
81 bool setResult = model.
getModel(gotA, gotB);
84 bool aEqual = (a[0] == gotA[0]) && (a[1] == gotA[1]) && (a[2] == gotA[2]) && (a[3] == gotA[3]);
87 bool bEqual = (b[0] == gotB[0]) && (b[1] == gotB[1]) && (b[2] == gotB[2]) && (b[3] == gotB[3]);
100 TestUtil test1(
"IonoModel",
"operator ==", __FILE__, __LINE__ );
101 std::string test_desc =
"IonoModel objects are created and compared to test operator == precision";
102 std::string test_fail_equals =
"These should be equal but they are not.";
103 std::string test_false_equals =
"These should NOT be equal but they are.";
106 double a[4] = {1.,2.,3.,4.};
107 double b[4] = {4.,3.,2.,1.};
108 double c[4] = {1.,2.,3.,4.};
109 double d[4] = {4.,3.,2.,1.};
110 double e[4] = {0.,0.,0.,0.};
115 test1.
assert( Model1 == Model2, test_desc + test_fail_equals, __LINE__ );
116 test1.
assert( !(Model1 == Model3), test_desc + test_false_equals, __LINE__ );
127 TestUtil test2(
"IonoModel",
"operator !=", __FILE__, __LINE__ );
128 std::string test_desc =
"IonoModel objects are created and compared to test operator != precision";
129 std::string test_fail_notequal =
"These should be [not equal] but they are not [not equal].";
130 std::string test_false_notequal =
"These should NOT be [not equal] but they are [not equal].";
133 double a[4] = {1.,2.,3.,4.};
134 double b[4] = {4.,3.,2.,1.};
135 double c[4] = {1.,2.,3.,4.};
136 double d[4] = {4.,3.,2.,1.};
137 double e[4] = {0.,0.,0.,0.};
142 test2.
assert( ( Model1 != Model2 )==
false, test_desc + test_fail_notequal, __LINE__ );
143 test2.
assert( ( Model1 != Model3 )==
true, test_desc + test_false_notequal, __LINE__ );
154 TestUtil test3(
"IonoModel",
"isValid", __FILE__, __LINE__ );
155 std::string test_desc =
"";
156 std::string test_fail =
"";
162 double a[4] = {1.,2.,3.,4.};
163 double b[4] = {4.,3.,2.,1.};
170 test_desc =
"IonoModel object created with no input parameters";
171 test_fail =
"should result in an invalid model but did not";
173 test3.
assert( !model_withNoParam.
isValid(), test_desc + test_fail, __LINE__ );
176 test_desc =
"IonoModel object created with multiple inputs";
177 test_fail =
"should result in a valid model but did not";
179 test3.
assert( model_withArray.
isValid(), test_desc + test_fail, __LINE__ );
182 test_desc =
"IonoModel object created with a blank EngAlamanac";
183 test_fail =
"should result in an invalid model but did no";
185 test3.
assert( !model_withblankAlmanac.
isValid(), test_desc + test_fail, __LINE__ );
200 TestUtil test4(
"IonoModel",
"exception", __FILE__, __LINE__ );
201 std::string test_desc =
"";
202 std::string test_fail =
"";
203 std::string assert_message =
"";
219 double a[4] = {1.,2.,3.,4.};
220 double b[4] = {4.,3.,2.,1.};
230 assert_message =
"blankAlmanac.getIon(), This test should have thrown an InvalidRequest exception";
231 test4.
assert(
false, assert_message, __LINE__ );
233 catch( gnsstk::InvalidRequest& exception_invalid )
235 assert_message =
"blankAlmanac.getIon(), This test threw an InvalidRequest exception as expected";
236 test4.
assert(
true, assert_message , __LINE__ );
240 assert_message =
"blankAlmanac.getIon(), This test should have thrown an InvalidRequest but threw a different type of exception";
241 test4.
assert(
false, assert_message , __LINE__ );
263 assert_message =
"getCorrection(), This test should have thrown an InvalidIonoModel exception";
264 test4.
assert(
false, assert_message, __LINE__ );
266 catch( gnsstk::IonoModel::InvalidIonoModel& exception_invalid )
268 assert_message =
"getCorrection(), This test threw an InvalidIonoModel exception as expected";
269 test4.
assert(
true, assert_message, __LINE__ );
273 assert_message =
"getCorrection(), This test should have thrown an InvalidRequest but threw a different type of exception";
274 test4.
assert(
false, assert_message, __LINE__ );
281 assert_message =
"getCorrection( L1 ), This test should NOT throw an exception";
282 test4.
assert(
true, assert_message, __LINE__ );
286 assert_message =
"getCorrection( L1 ), This test should NOT have thrown any exceptions but threw gnsstk::Exception";
287 test4.
assert(
false, assert_message, __LINE__ );
291 assert_message =
"getCorrection( L1 ), This test should NOT have thrown any exceptions but threw one anyway";
292 test4.
assert(
false, assert_message, __LINE__ );
300 assert_message =
"getCorrection( L2 ), This test should NOT throw an exception";
301 test4.
assert(
true, assert_message, __LINE__ );
305 assert_message =
"getCorrection( L2 ), This test should NOT have thrown any exceptions but threw gnsstk::Exception";
306 test4.
assert(
false, assert_message, __LINE__ );
310 assert_message =
"getCorrection( L2 ), This test should NOT have thrown any exceptions but threw one anyway";
311 test4.
assert(
false, assert_message, __LINE__ );
319 assert_message =
"getCorrection( commonTime,rxgeo,72.,45.,Model.L1 ), This test should NOT throw an exception";
320 test4.
assert(
true, assert_message, __LINE__ );
324 assert_message =
"getCorrection( commonTime,rxgeo,72.,45.,Model.L1 ), This test should NOT have thrown any exceptions but threw gnsstk::Exception";
325 test4.
assert(
false, assert_message, __LINE__ );
329 assert_message =
"getCorrection( commonTime,rxgeo,72.,45.,Model.L1 ), This test should NOT have thrown any exceptions but threw one anyway";
330 test4.
assert(
false, assert_message, __LINE__ );
342 int check, errorCounter = 0;
346 errorCounter += check;
349 errorCounter += check;
352 errorCounter += check;
355 errorCounter += check;
358 errorCounter += check;
360 std::cout <<
"Total Failures for " << __FILE__ <<
": " << errorCounter << std::endl;
362 return( errorCounter );