Changeset 6039 for trunk/psLib/test/astro/tst_psSphereOps.c
- Timestamp:
- Jan 18, 2006, 1:49:06 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astro/tst_psSphereOps.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astro/tst_psSphereOps.c
r5626 r6039 5 5 * @author d-Rob, MHPCC 6 6 * 7 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $8 * @date $Date: 200 5-11-30 02:17:17$7 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-01-18 23:49:06 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 18 18 static psS32 testSphereRotApply1(void); 19 19 static psS32 testSphereRotApplyCelestial(void); 20 static psS32 testSphereRotPrecess(void);20 //static psS32 testSphereRotPrecess(void); 21 21 static psS32 testSphereOffset(void); 22 22 … … 26 26 {testSphereRotApply1, 821, "psSphereRotApply()", 0, false}, 27 27 {testSphereRotApplyCelestial, 822, "psSphereRotApplyCel()", 0, false}, 28 {testSphereRotPrecess, 823, "psSphereRotPrecess()", 0, false},28 // {testSphereRotPrecess, 823, "psSphereRotPrecess()", 0, false}, 29 29 {testSphereOffset, 825, "testSphereOffset()", 0, false}, 30 30 {NULL} … … 298 298 } 299 299 300 #define SPHERE_PRECESS_TP1_R 0.0 // 0.0 degrees301 #define SPHERE_PRECESS_TP1_D 0.0 // 0.0 degrees302 #define SPHERE_PRECESS_TP1_EXPECT_R 6.238453 // 357.437 degrees303 #define SPHERE_PRECESS_TP1_EXPECT_D -0.019426 // -1.113 degrees304 #define SPHERE_PRECESS_TP2_R 0.0 // 0.0 degrees305 #define SPHERE_PRECESS_TP2_D 1.570796 // 90.0 degrees306 #define SPHERE_PRECESS_TP2_EXPECT_R 6.260828 // 358.719 degrees307 #define SPHERE_PRECESS_TP2_EXPECT_D 1.551353 // 88.886 degrees308 #define SPHERE_PRECESS_TP3_R 3.141593 // 180.0 degrees309 #define SPHERE_PRECESS_TP3_D 0.523599 // 30.0 degrees310 #define SPHERE_PRECESS_TP3_EXPECT_R 3.096616 // 177.423 degrees311 #define SPHERE_PRECESS_TP3_EXPECT_D 0.543024 // 31.113 degrees312 313 psS32 testSphereRotPrecess( void )314 {315 316 psSphere* inputCoord = psSphereAlloc();317 psSphere* outputCoord = NULL;318 psTime* fromTime = psTimeFromMJD(MJD_2100);319 psTime* toTime = psTimeFromMJD(MJD_1900);320 321 // Set input coordinate322 inputCoord->r = SPHERE_PRECESS_TP1_R;323 inputCoord->d = SPHERE_PRECESS_TP1_D;324 inputCoord->rErr = 0.0;325 inputCoord->dErr = 0.0;326 327 // Calculate precess328 outputCoord = psSpherePrecess(inputCoord, fromTime, toTime);329 // Verify return is not NULL330 if(outputCoord == NULL) {331 psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");332 return 1;333 }334 // Verify return with expected values335 if( fabs(outputCoord->r - SPHERE_PRECESS_TP1_EXPECT_R) > ERROR_TOL) {336 psError(PS_ERR_UNKNOWN,true,"Precess r = %lg not equal to expected = %lg",337 outputCoord->r,SPHERE_PRECESS_TP1_EXPECT_R);338 return 2;339 }340 if( fabs(outputCoord->d - SPHERE_PRECESS_TP1_EXPECT_D) > ERROR_TOL) {341 psError(PS_ERR_UNKNOWN,true,"Precess d = %lg not equal to expected = %lg",342 outputCoord->d,SPHERE_PRECESS_TP1_EXPECT_D);343 return 3;344 }345 psFree(outputCoord);346 347 // Set input coordinate348 inputCoord->r = SPHERE_PRECESS_TP2_R;349 inputCoord->d = SPHERE_PRECESS_TP2_D;350 inputCoord->rErr = 0.0;351 inputCoord->dErr = 0.0;352 353 // Calculate precess354 outputCoord = psSpherePrecess(inputCoord, fromTime, toTime);355 // Verify return is not NULL356 if(outputCoord == NULL) {357 psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");358 return 4;359 }360 // Verify return with expected values361 if( fabs(outputCoord->r - SPHERE_PRECESS_TP2_EXPECT_R) > ERROR_TOL) {362 psError(PS_ERR_UNKNOWN,true,"Precess r = %lg not equal to expected = %lg",363 outputCoord->r,SPHERE_PRECESS_TP2_EXPECT_R);364 return 5;365 }366 if( fabs(outputCoord->d - SPHERE_PRECESS_TP2_EXPECT_D) > ERROR_TOL) {367 psError(PS_ERR_UNKNOWN,true,"Precess d = %lg not equal to expected = %lg",368 outputCoord->d,SPHERE_PRECESS_TP2_EXPECT_D);369 return 6;370 }371 psFree(outputCoord);372 373 // Set input coordinate374 inputCoord->r = SPHERE_PRECESS_TP3_R;375 inputCoord->d = SPHERE_PRECESS_TP3_D;376 inputCoord->rErr = 0.0;377 inputCoord->dErr = 0.0;378 379 // Calculate precess380 outputCoord = psSpherePrecess(inputCoord, fromTime, toTime);381 // Verify return is not NULL382 if(outputCoord == NULL) {383 psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");384 return 7;385 }386 // Verify return with expected values387 if( fabs(outputCoord->r - SPHERE_PRECESS_TP3_EXPECT_R) > ERROR_TOL) {388 psError(PS_ERR_UNKNOWN,true,"Precess r = %lg not equal to expected = %lg",389 outputCoord->r,SPHERE_PRECESS_TP3_EXPECT_R);390 return 8;391 }392 if( fabs(outputCoord->d - SPHERE_PRECESS_TP3_EXPECT_D) > ERROR_TOL) {393 psError(PS_ERR_UNKNOWN,true,"Precess d = %lg not equal to expected = %lg",394 outputCoord->d,SPHERE_PRECESS_TP3_EXPECT_D);395 return 9;396 }397 psFree(outputCoord);398 399 // Invoke precess with invalid parameter400 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");401 outputCoord = psSpherePrecess(inputCoord, fromTime, NULL);402 if(outputCoord != NULL) {403 psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input");404 return 10;405 }406 407 // Invoke precess with invalid parameter408 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");409 outputCoord = psSpherePrecess(inputCoord, NULL, toTime);410 if(outputCoord != NULL) {411 psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input");412 return 11;413 }414 415 // Invoke precess with invalid parameter416 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");417 outputCoord = psSpherePrecess(NULL, fromTime, toTime);418 if(outputCoord != NULL) {419 psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input");420 return 12;421 }422 423 // Free objects424 psFree(fromTime);425 psFree(toTime);426 psFree(inputCoord);427 428 return 0;429 }430 431 300 psS32 testSphereOffset(void) 432 301 {
Note:
See TracChangeset
for help on using the changeset viewer.
