Changeset 3293
- Timestamp:
- Feb 18, 2005, 4:55:33 PM (21 years ago)
- Location:
- trunk/psLib/test/astronomy
- Files:
-
- 3 edited
-
tst_psCoord.c (modified) (6 diffs)
-
verified/tst_psCoord.stderr (modified) (1 diff)
-
verified/tst_psCoord.stdout (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astronomy/tst_psCoord.c
r3264 r3293 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-02-1 7 19:26:24$8 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-02-19 02:55:33 $ 10 10 * 11 11 * XXX: Must test psSpherePrecess. … … 22 22 #include "psTest.h" 23 23 #include "pslib.h" 24 static psS32 test 1( void );24 static psS32 testSphereTransformAlloc( void ); 25 25 static psS32 test1b( void ); 26 26 static psS32 test1c( void ); 27 27 static psS32 test2( void ); 28 28 static psS32 test3( void ); 29 static psS32 test 4( void );29 static psS32 testSphereTransformApply1( void ); 30 30 static psS32 test4b( void ); 31 31 static psS32 test5( void ); … … 40 40 //static psS32 test43( void ); 41 41 testDescription tests[] = { 42 {test 1, 0000, "psSphereTransformAlloc()", 0, false},42 {testSphereTransformAlloc, 819, "psSphereTransformAlloc()", 0, false}, 43 43 {test1b, 0000, "psPlaneTransformAlloc()", 0, false}, 44 44 {test1c, 0000, "psPlaneDistortAlloc()", 0, false}, 45 45 {test2, 0000, "psPlaneTransformApply()", 0, false}, 46 46 {test3, 0000, "psPlaneDistortApply()", 0, false}, 47 {test 4, 0000, "psPSphereTransformApply()", 0, false},47 {testSphereTransformApply1, 0000, "psPSphereTransformApply()", 0, false}, 48 48 {test4b, 0000, "psPSphereTransformApply()", 0, false}, 49 49 {test5, 0000, "psSphereTransformICRSToEcliptic()", 0, false}, … … 90 90 #define DELTA_P 2.0 91 91 #define PHI_P 3.0 92 psS32 test 1( void )93 { 94 psS32 testStatus = 0;92 psS32 testSphereTransformAlloc( void ) 93 { 94 // Allocate data structure 95 95 psSphereTransform *myST = psSphereTransformAlloc(ALPHA_P, DELTA_P, PHI_P); 96 96 // Verify null not returned 97 if(myST == NULL) { 98 psError(PS_ERR_UNKNOWN,true,"Returned NULL with valid parameters"); 99 return 1; 100 } 101 // Verify sin member is updated 97 102 psF32 sinDeltaP = sin(DELTA_P); 98 103 if (FLT_EPSILON < fabs(sinDeltaP - myST->sinDeltaP)) { 99 printf("ERROR: myST->sinDeltaP is %f, should be %f\n", myST->sinDeltaP, sinDeltaP); 100 testStatus = 1; 101 } 104 psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f\n", myST->sinDeltaP, sinDeltaP); 105 return 2; 106 } 107 // Verify cos member is update 102 108 psF32 cosDeltaP = cos(DELTA_P); 103 109 if (FLT_EPSILON < fabs(cosDeltaP - myST->cosDeltaP)) { 104 p rintf("ERROR:myST->cosDeltaP is %f, should be %f\n", myST->cosDeltaP, cosDeltaP);105 testStatus = 1;106 } 107 110 psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f\n", myST->cosDeltaP, cosDeltaP); 111 return 3; 112 } 113 // Verify alpha is updated 108 114 if (FLT_EPSILON < fabs(ALPHA_P - myST->alphaP)) { 109 p rintf("ERROR:myST->alphaP is %f, should be %f\n", myST->alphaP, ALPHA_P);110 testStatus = 3;111 } 112 115 psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f\n", myST->alphaP, ALPHA_P); 116 return 4; 117 } 118 // Verify phi is updated 113 119 if (FLT_EPSILON < fabs(PHI_P - myST->phiP)) { 114 p rintf("ERROR:myST->phiP is %f, should be %f\n", myST->phiP, PHI_P);115 testStatus = 4;116 } 117 120 psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f\n", myST->phiP, PHI_P); 121 return 5; 122 } 123 // Free data structure 118 124 psFree(myST); 119 return(testStatus); 125 126 return 0; 120 127 } 121 128 … … 430 437 #define DEG_INC 30.0 431 438 // We do a simple identity transformation on a few RA, DEC pairs. 432 psS32 test 4( void )433 { 434 psS 32 testStatus = 0;435 psSphere in;436 psSphere out;439 psS32 testSphereTransformApply1( void ) 440 { 441 psSphere *in = psSphereAlloc(); 442 psSphere *out = psSphereAlloc(); 443 psSphere *temp = NULL; 437 444 psSphere *rc = NULL; 438 445 psSphereTransform *myST = psSphereTransformAlloc(0.0, 0.0, 0.0); 439 446 440 in .r = DEG_TO_RAD(45.0);441 in .d = DEG_TO_RAD(30.0);442 in .rErr = 0.0;443 in .dErr = 0.0;447 in->r = DEG_TO_RAD(45.0); 448 in->d = DEG_TO_RAD(30.0); 449 in->rErr = 0.0; 450 in->dErr = 0.0; 444 451 445 452 for (float r=0.0;r<180.0;r+=DEG_INC) { 446 453 for (float d=0.0;d<90.0;d+=DEG_INC) { 447 in.r = DEG_TO_RAD(r); 448 in.d = DEG_TO_RAD(d); 449 in.rErr = 0.0; 450 in.dErr = 0.0; 451 452 psSphereTransformApply(&out, myST, &in); 453 454 if (FLT_EPSILON < fabs(out.r - in.r)) { 455 printf("ERROR: out.r is %f, should be %f\n", out.r, in.r); 456 testStatus = 4; 454 in->r = DEG_TO_RAD(r); 455 in->d = DEG_TO_RAD(d); 456 in->rErr = 0.0; 457 in->dErr = 0.0; 458 459 if(psSphereTransformApply(out, myST, in) != out) { 460 psError(PS_ERR_UNKNOWN,true,"Did not return output pointer."); 461 return 1; 457 462 } 458 459 if (FLT_EPSILON < fabs(out.d - in.d)) { 460 printf("ERROR: out.d is %f, should be %f\n", out.d, in.d); 461 testStatus = 5; 463 if (FLT_EPSILON < fabs(out->r - in->r)) { 464 psError(PS_ERR_UNKNOWN,true,"out->r is %f, should be %f\n", out->r, in->r); 465 return 2; 466 } 467 if (FLT_EPSILON < fabs(out->d - in->d)) { 468 psError(PS_ERR_UNKNOWN,true,"out->d is %f, should be %f\n", out->d, in->d); 469 return 3; 462 470 } 463 471 // printf("psSphereTransformApply (%f, %f) -> (%f, %f)\n", out.r, out.d, in.r, in.d); … … 465 473 } 466 474 467 printf("-------------------------------------------------------------------\n"); 468 printf("Calling psSphereTransformApply() with NULL psSphereTransform. Should generate error, return NULL.\n"); 469 rc = psSphereTransformApply(NULL, NULL, &in); 475 // Verify new sphere object is created if out parameter NULL 476 temp = psSphereTransformApply(NULL, myST, in); 477 if ( temp == NULL) { 478 psError(PS_ERR_UNKNOWN,true,"Returned NULL when out parameter was null"); 479 return 4; 480 } 481 psFree(temp); 482 483 // Verify NULL returned if transform structure null 484 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error"); 485 rc = psSphereTransformApply(NULL, NULL, in); 470 486 if (rc != NULL) { 471 printf("TEST ERROR: psSphereTransformApply() did not return NULL.\n"); 472 testStatus = false; 473 rc = NULL; 474 } 475 476 printf("-------------------------------------------------------------------\n"); 477 printf("Calling psSphereTransformApply() with NULL input coords. Should generate error, return NULL.\n"); 487 psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply() did not return NULL."); 488 return 5; 489 } 490 491 // Verify NULL returned when input sphere is NULL 492 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error"); 478 493 rc = psSphereTransformApply(NULL, myST, NULL); 479 494 if (rc != NULL) { 480 printf("TEST ERROR: psSphereTransformApply() did not return NULL.\n"); 481 testStatus = false; 482 rc = NULL; 483 } 484 485 printf("-------------------------------------------------------------------\n"); 495 psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply() did not return NULL"); 496 return 6; 497 } 498 486 499 psFree(myST); 487 return(testStatus); 500 psFree(out); 501 psFree(in); 502 503 return 0; 488 504 } 489 505 -
trunk/psLib/test/astronomy/verified/tst_psCoord.stderr
r3127 r3293 78 78 \**********************************************************************************/ 79 79 80 <DATE><TIME>|<HOST>|I|testSphereTransformApply1 81 Following should generate an error 80 82 <DATE><TIME>|<HOST>|E|psSphereTransformApply (FILE:LINENO) 81 83 Unallowable operation: transform is NULL. 84 <DATE><TIME>|<HOST>|I|testSphereTransformApply1 85 Following should generate an error 82 86 <DATE><TIME>|<HOST>|E|psSphereTransformApply (FILE:LINENO) 83 87 Unallowable operation: coord is NULL. -
trunk/psLib/test/astronomy/verified/tst_psCoord.stdout
r2999 r3293 32 32 ------------------------------------------------------------------- 33 33 ------------------------------------------------------------------- 34 Calling psSphereTransformApply() with NULL psSphereTransform. Should generate error, return NULL.35 -------------------------------------------------------------------36 Calling psSphereTransformApply() with NULL input coords. Should generate error, return NULL.37 -------------------------------------------------------------------38 -------------------------------------------------------------------39 34 Calling psSphereTransformICRSToEcliptic() with NULL input. Should generate error, return NULL. 40 35 -------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.
