Changeset 3431
- Timestamp:
- Mar 15, 2005, 4:31:07 PM (21 years ago)
- Location:
- trunk/psLib/test/astronomy
- Files:
-
- 3 edited
-
tst_psCoord.c (modified) (4 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
r3367 r3431 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-03- 02 23:00:17$8 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-03-16 02:31:05 $ 10 10 * 11 11 * XXX: THe psProject() and psDeproject() functions do not work fully. They … … 24 24 static psS32 testPlaneTransformAlloc( void ); 25 25 static psS32 testPlaneDistortAlloc( void ); 26 static psS32 test 2( void );26 static psS32 testPlaneTransformApply( void ); 27 27 static psS32 test3( void ); 28 28 static psS32 testSphereTransformApply1( void ); … … 46 46 {testPlaneTransformAlloc, 826, "psPlaneTransformAlloc()", 0, false}, 47 47 {testPlaneDistortAlloc, 827, "psPlaneDistortAlloc()", 0, false}, 48 {test 2, 0000, "psPlaneTransformApply()", 0, false},48 {testPlaneTransformApply, 0000, "psPlaneTransformApply()", 0, false}, 49 49 {test3, 0000, "psPlaneDistortApply()", 0, false}, 50 50 {testSphereTransformApply1, 820, "psSphereTransformApply()", 0, false}, … … 294 294 #define N 10 295 295 // We do a simple identity transformation on a few x,y pairs. 296 psS32 test2( void ) 297 { 298 psS32 i; 299 psS32 testStatus = 0; 300 psPlane in; 301 psPlane out; 302 psPlane *rc; 303 psPlaneTransform pt; 304 psDPolynomial2D *tmp2DPoly = NULL; 305 306 pt.x = psDPolynomial2DAlloc(2, 2, PS_POLYNOMIAL_ORD); 307 pt.y = psDPolynomial2DAlloc(2, 2, PS_POLYNOMIAL_ORD); 308 pt.x->coeff[1][0] = 1.0; 309 pt.y->coeff[0][1] = 1.0; 310 for (i=0;i<N;i++) { 311 in.x = (float) i; 312 in.y = (float) (i + 5.0); 313 in.xErr = 0.0; 314 in.yErr = 0.0; 315 psPlaneTransformApply(&out, &pt, &in); 316 317 if (FLT_EPSILON < fabs(out.x - in.x)) { 318 printf("ERROR: out.x is %f, should be %f\n", out.x, in.x); 319 testStatus = 3; 296 psS32 testPlaneTransformApply( void ) 297 { 298 psPlane* out = NULL; 299 psDPolynomial2D* tmp2DPoly = NULL; 300 psPlane* rc; 301 302 // Create input coordinate 303 psPlane* in = psPlaneAlloc(); 304 if(in == NULL) { 305 psError(PS_ERR_UNKNOWN,true,"Did not expect NULL return from psPlaneAlloc"); 306 return 1; 307 } 308 309 // Create transform 310 psPlaneTransform* pt = psPlaneTransformAlloc(2,2); 311 312 // Set transform coefficients so the x coord input will equal x coord output, same for y 313 pt->x->coeff[1][0] = 1.0; 314 pt->y->coeff[0][1] = 1.0; 315 316 // Apply transform for several points 317 for (psS32 i = 0; i < N; i++) { 318 in->x = (psF64) i; 319 in->y = (psF64) (i + 5.0); 320 in->xErr = 0.0; 321 in->yErr = 0.0; 322 323 // Verify function does not return NULL 324 out = psPlaneTransformApply(out, pt, in); 325 if( out == NULL) { 326 psError(PS_ERR_UNKNOWN,true,"Expected non-NULL return value"); 327 return 1; 320 328 } 321 322 if (FLT_EPSILON < fabs(out .y - in.y)) {323 p rintf("ERROR: out.y is %f, should be %f\n", out.y, in.y);324 testStatus = 4;329 // Verify the expected values are returned 330 if (FLT_EPSILON < fabs(out->x - in->x)) { 331 psError(PS_ERR_UNKNOWN,true,"out.x is %lf, should be %lf", out->x, in->x); 332 return 3; 325 333 } 326 //printf("psPlaneTransformApply(): (%f, %f) -> (%f, %f)\n", in.x, in.y, out.x, out.y); 327 } 328 329 printf("-------------------------------------------------------------------\n"); 330 printf("Calling psPlaneTransformApply() with NULL psPlaneTransform. Should generate error, return NULL.\n"); 331 rc = psPlaneTransformApply(NULL, NULL, &in); 334 if (FLT_EPSILON < fabs(out->y - in->y)) { 335 psError(PS_ERR_UNKNOWN,true,"out.y is %lf, should be %lf", out->y, in->y); 336 return 4; 337 } 338 } 339 psFree(out); 340 341 // Verify return null and error message generater for null specified transform 342 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message for NULL psPlaneTransform"); 343 rc = psPlaneTransformApply(NULL, NULL, in); 332 344 if (rc != NULL) { 333 printf("TEST ERROR: psPlaneTransformApply() did not return NULL.\n"); 334 testStatus = false; 335 rc = NULL; 336 } 337 338 printf("-------------------------------------------------------------------\n"); 339 printf("Calling psPlaneTransformApply() with NULL psPlaneTransform->x. Should generate error, return NULL.\n"); 340 tmp2DPoly = pt.x; 341 pt.x = NULL; 342 rc = psPlaneTransformApply(NULL, &pt, &in); 345 psError(PS_ERR_UNKNOWN,true,"Function did not return NULL as expected for NULL psPlaneTransform."); 346 return 5; 347 } 348 349 // Verify return null and error message generated for null psPlaneTransform x coeff 350 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message for NULL x coeff psPlaneTransform"); 351 tmp2DPoly = pt->x; 352 pt->x = NULL; 353 rc = psPlaneTransformApply(NULL, pt, in); 343 354 if (rc != NULL) { 344 printf("TEST ERROR: psPlaneTransformApply() did not return NULL.\n"); 345 testStatus = false; 346 rc = NULL; 347 } 348 pt.x = tmp2DPoly; 349 350 printf("-------------------------------------------------------------------\n"); 351 printf("Calling psPlaneTransformApply() with NULL psPlaneTransform->y. Should generate error, return NULL.\n"); 352 tmp2DPoly = pt.y; 353 pt.y = NULL; 354 rc = psPlaneTransformApply(NULL, &pt, &in); 355 psError(PS_ERR_UNKNOWN,true,"Function did not return NULL as expected for NULL x coeff psPlaneTransform"); 356 return 6; 357 } 358 pt->x = tmp2DPoly; 359 360 // Verify return null and error message generated for null psPlaneTransform y coeff 361 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message for NULL y coeff psPlaneTransform"); 362 tmp2DPoly = pt->y; 363 pt->y = NULL; 364 rc = psPlaneTransformApply(NULL, pt, in); 355 365 if (rc != NULL) { 356 printf("TEST ERROR: psPlaneTransformApply() did not return NULL.\n"); 357 testStatus = false; 358 rc = NULL; 359 } 360 pt.y = tmp2DPoly; 361 362 printf("-------------------------------------------------------------------\n"); 363 printf("Calling psPlaneTransformApply() with NULL input coords. Should generate error, return NULL.\n"); 364 rc = psPlaneTransformApply(NULL, &pt, NULL); 366 psError(PS_ERR_UNKNOWN,true,"Function did not return NULL as expected for NULL y coeff psPlaneTransform"); 367 return 7; 368 } 369 pt->y = tmp2DPoly; 370 371 // Verify return null and error message generated for null psPlane coordinate 372 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message for NULL psPlane"); 373 rc = psPlaneTransformApply(NULL, pt, NULL); 365 374 if (rc != NULL) { 366 printf("TEST ERROR: psPlaneTransformApply() did not return NULL.\n"); 367 testStatus = false; 368 rc = NULL; 369 } 370 371 printf("-------------------------------------------------------------------\n"); 372 psFree(pt.x); 373 psFree(pt.y); 374 return(testStatus); 375 psError(PS_ERR_UNKNOWN,true,"Function did not return NULL as expected for NULL psPlane"); 376 return 8; 377 } 378 379 psFree(pt); 380 psFree(in); 381 382 return 0; 375 383 } 376 384 -
trunk/psLib/test/astronomy/verified/tst_psCoord.stderr
r3367 r3431 56 56 \**********************************************************************************/ 57 57 58 <DATE><TIME>|<HOST>|I|testPlaneTransformApply 59 Following should generate error message for NULL psPlaneTransform 58 60 <DATE><TIME>|<HOST>|E|psPlaneTransformApply (FILE:LINENO) 59 61 Unallowable operation: transform is NULL. 62 <DATE><TIME>|<HOST>|I|testPlaneTransformApply 63 Following should generate error message for NULL x coeff psPlaneTransform 60 64 <DATE><TIME>|<HOST>|E|psPlaneTransformApply (FILE:LINENO) 61 65 Unallowable operation: transform->x is NULL. 66 <DATE><TIME>|<HOST>|I|testPlaneTransformApply 67 Following should generate error message for NULL y coeff psPlaneTransform 62 68 <DATE><TIME>|<HOST>|E|psPlaneTransformApply (FILE:LINENO) 63 69 Unallowable operation: transform->y is NULL. 70 <DATE><TIME>|<HOST>|I|testPlaneTransformApply 71 Following should generate error message for NULL psPlane 64 72 <DATE><TIME>|<HOST>|E|psPlaneTransformApply (FILE:LINENO) 65 73 Unallowable operation: coords is NULL. -
trunk/psLib/test/astronomy/verified/tst_psCoord.stdout
r3367 r3431 1 -------------------------------------------------------------------2 Calling psPlaneTransformApply() with NULL psPlaneTransform. Should generate error, return NULL.3 -------------------------------------------------------------------4 Calling psPlaneTransformApply() with NULL psPlaneTransform->x. Should generate error, return NULL.5 -------------------------------------------------------------------6 Calling psPlaneTransformApply() with NULL psPlaneTransform->y. Should generate error, return NULL.7 -------------------------------------------------------------------8 Calling psPlaneTransformApply() with NULL input coords. Should generate error, return NULL.9 -------------------------------------------------------------------10 1 ------------------------------------------------------------------- 11 2 Calling psPlaneDistortApply() with NULL psPlaneDistort. Should generate error, return NULL.
Note:
See TracChangeset
for help on using the changeset viewer.
