Changeset 12414 for trunk/psLib/test/astro/tap_psTime_03.c
- Timestamp:
- Mar 12, 2007, 2:19:21 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astro/tap_psTime_03.c (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astro/tap_psTime_03.c
r12407 r12414 11 11 * @author Eric Van Alst, MHPCC 12 12 * 13 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2007-03-1 2 21:11:21 $13 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2007-03-13 00:19:21 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 172 172 //const char testTimeB2StrUT1[] = "1998-12-31T23:59:58,2Z"; 173 173 174 psS32 main(psS32argc, char* argv[])174 int main(int argc, char* argv[]) 175 175 { 176 176 psLogSetFormat("HLNM"); 177 177 psLogSetLevel(PS_LOG_INFO); 178 plan_tests(7 2);178 plan_tests(77); 179 179 psLibInit("pslib.config"); 180 180 … … 185 185 { 186 186 psMemId id = psMemGetId(); 187 187 188 ok(psTimeMath(NULL, -1.1) == NULL, "psTimeMath(NULL, -1.1) returned NULL"); 189 188 190 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 189 191 } … … 199 201 time->sec = 0; 200 202 time->nsec = 2e9; 203 201 204 ok(psTimeMath(time, -1.1) == NULL, "psTimeMath() returns NULL for unallowable time input"); 205 202 206 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 203 207 } … … 211 215 time->sec = testTime1SecondsUTC; 212 216 time->nsec = testTime1NanosecondsUTC; 217 213 218 psTime *newTime = psTimeMath(time, deltaTime1); 214 219 ok(newTime != NULL, "psTimeMath() returns non-NULL for allowable time input (PS_TIME_UTC)"); 215 220 skip_start(newTime == NULL, 2, "Skipping tests because psTimeMath() returned NULL"); 216 221 ok(newTime->type == PS_TIME_UTC, "psTimeMath() returns the correct type (PS_TIME_UTC)"); 217 ok((newTime->sec == newTestTime1SecondsUTC) && (newTime->nsec == newTestTime1NanosecondsUTC),218 "psTimeMath() returns the correct ->sec and ->nsec (PS_TIME_UTC)");222 is_long(newTime->sec, newTestTime1SecondsUTC, "psTimeMath() returns the correct ->sec"); 223 is_long(newTime->nsec, newTestTime1NanosecondsUTC, "psTimeMath() returns the correct ->nsec"); 219 224 skip_end(); 225 220 226 psFree(newTime); 221 227 psFree(time); … … 228 234 { 229 235 psMemId id = psMemGetId(); 230 psTime *time = psTimeAlloc(PS_TIME_ UTC);236 psTime *time = psTimeAlloc(PS_TIME_TAI); 231 237 time->sec = testTime1SecondsTAI; 232 238 time->nsec = testTime1NanosecondsTAI; 233 time->type = PS_TIME_TAI; 239 234 240 psTime *newTime = psTimeMath(time, deltaTime1); 235 241 ok(newTime != NULL, "psTimeMath() returns non-NULL for allowable time input (PS_TIME_TAI)"); 236 242 skip_start(newTime == NULL, 2, "Skipping tests because psTimeMath() returned NULL"); 237 243 ok(newTime->type == PS_TIME_TAI, "psTimeMath() returns the correct type (PS_TIME_TAI)"); 238 ok((newTime->sec == newTestTime1SecondsTAI) && (newTime->nsec == newTestTime1NanosecondsTAI),239 "psTimeMath() returns the correct ->sec and ->nsec (PS_TIME_TAI)");244 is_long(newTime->sec, newTestTime1SecondsTAI, "psTimeMath() returns the correct ->sec"); 245 is_long(newTime->nsec, newTestTime1NanosecondsTAI, "psTimeMath() returns the correct ->nsec"); 240 246 skip_end(); 247 241 248 psFree(newTime); 242 249 psFree(time); … … 249 256 { 250 257 psMemId id = psMemGetId(); 251 psTime *time = psTimeAlloc(PS_TIME_ UTC);258 psTime *time = psTimeAlloc(PS_TIME_TT); 252 259 time->sec = testTime1SecondsTT; 253 260 time->nsec = testTime1NanosecondsTT; 254 time->type = PS_TIME_TT; 261 255 262 psTime *newTime = psTimeMath(time,deltaTime2); 256 263 ok(newTime != NULL, "psTimeMath() returns non-NULL for allowable time input (PS_TIME_TT)"); 257 264 skip_start(newTime == NULL, 2, "Skipping tests because psTimeMath() returned NULL"); 258 265 ok(newTime->type == PS_TIME_TT, "psTimeMath() returns the correct type (PS_TIME_TT)"); 259 ok((newTime->sec == newTestTime1SecondsTT) && (newTime->nsec == newTestTime1NanosecondsTT),260 "psTimeMath() returns the correct ->sec and->nsec (PS_TIME_TT)");266 is_long(newTime->sec, newTestTime1SecondsTT, "psTimeMath() returns the correct ->sec (PS_TIME_TT)"); 267 is_long(newTime->nsec, newTestTime1NanosecondsTT, "psTimeMath() returns the correct ->nsec (PS_TIME_TT)"); 261 268 skip_end(); 269 262 270 psFree(newTime); 263 271 psFree(time); … … 270 278 { 271 279 psMemId id = psMemGetId(); 272 psTime *time = psTimeAlloc(PS_TIME_UT C);280 psTime *time = psTimeAlloc(PS_TIME_UT1); 273 281 time->sec = testTime1SecondsUT1; 274 282 time->nsec = testTime1NanosecondsUT1; 275 time->type = PS_TIME_UT1; 283 276 284 psTime *newTime = psTimeMath(time,deltaTime2); 277 285 ok(newTime != NULL, "psTimeMath() returns non-NULL for allowable time input (PS_TIME_UT1)"); 278 286 skip_start(newTime == NULL, 2, "Skipping tests because psTimeMath() returned NULL"); 279 287 ok(newTime->type == PS_TIME_UT1, "psTimeMath() returns the correct type (PS_TIME_UT1)"); 280 ok((newTime->sec == newTestTime1SecondsUT1) && (newTime->nsec == newTestTime1NanosecondsUT1),281 "psTimeMath() returns the correct ->sec and->nsec (PS_TIME_UT1)");288 is_long(newTime->sec, newTestTime1SecondsUT1, "psTimeMath() returns the correct ->sec (PS_TIME_UT1)"); 289 is_long(newTime->nsec, newTestTime1NanosecondsUT1, "psTimeMath() returns the correct ->nsec (PS_TIME_UT1)"); 282 290 skip_end(); 291 283 292 psFree(newTime); 284 293 psFree(time); … … 294 303 time->sec = testTime2SecondsUTC; 295 304 time->nsec = testTime2NanosecondsUTC; 296 time->type = PS_TIME_UTC; 297 psTime *newTime = psTimeMath(time, deltaTime3);305 306 psTime *newTime = psTimeMath(time, deltaTime3); 298 307 ok(newTime != NULL, "psTimeMath() returns non-NULL for allowable time input (PS_TIME_UTC)"); 299 308 skip_start(newTime == NULL, 2, "Skipping tests because psTimeMath() returned NULL"); 300 309 ok(newTime->type == PS_TIME_UTC, "psTimeMath() returns the correct type (PS_TIME_UTC)"); 301 ok((newTime->sec == newTestTime2SecondsUTC) && (newTime->nsec == newTestTime2NanosecondsUTC),302 "psTimeMath() returns the correct ->sec and->nsec (PS_TIME_UTC)");310 is_long(newTime->sec, newTestTime2SecondsUTC, "psTimeMath() returns the correct ->sec (PS_TIME_UTC)"); 311 is_long(newTime->nsec, newTestTime2NanosecondsUTC, "psTimeMath() returns the correct ->nsec (PS_TIME_UTC)"); 303 312 skip_end(); 313 304 314 psFree(newTime); 305 315 psFree(time); … … 314 324 { 315 325 psMemId id = psMemGetId(); 326 316 327 psF64 delta = psTimeDelta(NULL, NULL); 317 ok(fabs(delta-0.0) < ERROR_TOL, "psTimeDelta(NULL, NULL) returned 0.0"); 328 ok_double_tol(delta, 0.0, ERROR_TOL, "psTimeDelta(NULL, NULL) returned 0.0"); 329 318 330 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 319 331 } … … 327 339 psMemId id = psMemGetId(); 328 340 psTime *time1 = psTimeAlloc(PS_TIME_UTC); 341 329 342 psF64 delta = psTimeDelta(time1, NULL); 330 ok(fabs(delta-0.0) < ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0"); 343 ok_double_tol(delta, 0.0, ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0"); 344 331 345 psFree(time1); 332 346 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 344 358 time1->sec = 0; 345 359 time1->nsec = 2e9; 360 346 361 psF64 delta = psTimeDelta(time1, time2); 347 ok(fabs(delta-0.0) < ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0 for unallowed time1 arg"); 362 ok_double_tol(delta, 0.0, ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0 for unallowed time1 arg"); 363 348 364 psFree(time1); 349 365 psFree(time2); … … 364 380 time2->sec = 0; 365 381 time2->nsec = 2e9; 382 366 383 psF64 delta = psTimeDelta(time1, time2); 367 ok(fabs(delta-0.0) < ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0 for unallowed time2 arg"); 384 ok_double_tol(delta, 0.0, ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0 for unallowed time2 arg"); 385 368 386 psFree(time1); 369 387 psFree(time2); … … 386 404 time2->sec = newTestTime1SecondsUTC; 387 405 time2->nsec = newTestTime1NanosecondsUTC; 406 388 407 psF64 delta = psTimeDelta(time1, time2); 389 ok(fabs(delta-0.0) < ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0 for different time types"); 408 ok_double_tol(delta, 0.0, ERROR_TOL, "psTimeDelta(time1, NULL) returned 0.0 for different time types"); 409 390 410 psFree(time1); 391 411 psFree(time2); … … 406 426 time2->sec = newTestTime1SecondsUTC; 407 427 time2->nsec = newTestTime1NanosecondsUTC; 428 408 429 psF64 delta = psTimeDelta(time2, time1); 409 ok(fabs(delta-deltaTime1) < ERROR_TOL, "psTimeDelta(time1, NULL) returned correct delta for times of the same type"); 430 ok_double_tol(delta, deltaTime1, ERROR_TOL, "psTimeDelta(time1, NULL) returned correct delta for times of the same type"); 431 410 432 psFree(time1); 411 433 psFree(time2); … … 427 449 time2->nsec = newTestTime1NanosecondsTT; 428 450 time2->type = PS_TIME_TT; 451 429 452 psF64 delta = psTimeDelta(time2,time1); 430 ok(fabs(delta-deltaTime2) < ERROR_TOL, "psTimeDelta(time1, NULL) returned correct delta for times of the same type"); 453 ok_double_tol(delta, deltaTime2, ERROR_TOL, "psTimeDelta(time1, NULL) returned correct delta for times of the same type"); 454 431 455 psFree(time1); 432 456 psFree(time2); … … 448 472 time2->nsec = newTestTime2NanosecondsUTC; 449 473 time2->type = PS_TIME_UTC; 474 450 475 psF64 delta = psTimeDelta(time2,time1); 451 ok(fabs(delta-deltaTime3) < ERROR_TOL, "psTimeDelta(time1, NULL) returned correct delta for times of the same type"); 476 ok_double_tol(delta, deltaTime3, ERROR_TOL, "psTimeDelta(time1, NULL) returned correct delta for times of the same type"); 477 452 478 psFree(time1); 453 479 psFree(time2);
Note:
See TracChangeset
for help on using the changeset viewer.
