Changeset 3432
- Timestamp:
- Mar 15, 2005, 5:26:39 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
r3431 r3432 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-03-16 0 2:31:05$8 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-03-16 03:26:39 $ 10 10 * 11 11 * XXX: THe psProject() and psDeproject() functions do not work fully. They … … 25 25 static psS32 testPlaneDistortAlloc( void ); 26 26 static psS32 testPlaneTransformApply( void ); 27 static psS32 test 3( void );27 static psS32 testPlaneDistortApply( void ); 28 28 static psS32 testSphereTransformApply1( void ); 29 29 static psS32 testSphereTransformApply2( void ); … … 46 46 {testPlaneTransformAlloc, 826, "psPlaneTransformAlloc()", 0, false}, 47 47 {testPlaneDistortAlloc, 827, "psPlaneDistortAlloc()", 0, false}, 48 {testPlaneTransformApply, 0000, "psPlaneTransformApply()", 0, false},49 {test 3, 0000, "psPlaneDistortApply()", 0, false},48 {testPlaneTransformApply, 831, "psPlaneTransformApply()", 0, false}, 49 {testPlaneDistortApply, 832, "psPlaneDistortApply()", 0, false}, 50 50 {testSphereTransformApply1, 820, "psSphereTransformApply()", 0, false}, 51 51 {testSphereTransformApply2, 820, "psSphereTransformApply()", 0, false}, … … 387 387 // We do a simple identity transformation on a few x,y pairs. For x and y, 388 388 // we add in the COLOR and MAGNITUDE. 389 psS32 test3( void ) 390 { 391 psS32 i; 392 psS32 testStatus = 0; 393 psPlane in; 394 psPlane out; 395 psPlaneDistort pt; 396 psPlane *rc = NULL; 397 psDPolynomial4D *tmp4DPoly = NULL; 398 399 pt.x = psDPolynomial4DAlloc(2, 2, 2, 2, PS_POLYNOMIAL_ORD); 400 pt.y = psDPolynomial4DAlloc(2, 2, 2, 2, PS_POLYNOMIAL_ORD); 401 pt.x->coeff[1][0][0][0] = 1.0; 402 pt.x->coeff[0][0][1][0] = 1.0; 403 pt.x->coeff[0][0][0][1] = 1.0; 404 pt.y->coeff[0][1][0][0] = 1.0; 405 pt.y->coeff[0][0][1][0] = 1.0; 406 pt.y->coeff[0][0][0][1] = 1.0; 407 for (i=0;i<N;i++) { 408 in.x = (float) i; 409 in.y = (float) (i + 5.0); 410 in.xErr = 0.0; 411 in.yErr = 0.0; 412 psPlaneDistortApply(&out, &pt, &in, COLOR, MAGNITUDE); 413 414 if (FLT_EPSILON < fabs(out.x - COLOR - MAGNITUDE - in.x)) { 415 printf("ERROR: out.x is %f, should be %f\n", out.x, in.x + COLOR + MAGNITUDE); 416 testStatus = 3; 389 psS32 testPlaneDistortApply( void ) 390 { 391 psPlane* out = NULL; 392 psPlane* rc = NULL; 393 psDPolynomial4D* tmp4DPoly = NULL; 394 395 // Allocate input coordinate 396 psPlane* in = psPlaneAlloc(); 397 398 // Create psPlaneTransform structure 399 psPlaneDistort* pt = psPlaneDistortAlloc(2, 2, 2, 2); 400 401 pt->x->coeff[1][0][0][0] = 1.0; 402 pt->x->coeff[0][0][1][0] = 1.0; 403 pt->x->coeff[0][0][0][1] = 1.0; 404 405 pt->y->coeff[0][1][0][0] = 1.0; 406 pt->y->coeff[0][0][1][0] = 1.0; 407 pt->y->coeff[0][0][0][1] = 1.0; 408 409 for (psS32 i = 0; i < N; i++) { 410 in->x = (psF64) i; 411 in->y = (psF64) (i + 5.0); 412 in->xErr = 0.0; 413 in->yErr = 0.0; 414 out = psPlaneDistortApply(out, pt, in, COLOR, MAGNITUDE); 415 416 // Verify return value is not NULL 417 if(out == NULL) { 418 psError(PS_ERR_UNKNOWN,true,"Expected non-NULL return"); 419 return 1; 417 420 } 418 419 if (FLT_EPSILON < fabs(out.y - COLOR - MAGNITUDE - in.y)) { 420 printf("ERROR: out.y is %f, should be %f\n", out.y, in.y + COLOR + MAGNITUDE); 421 testStatus = 3; 421 // Verify return value contains expected values 422 if (FLT_EPSILON < fabs(out->x - COLOR - MAGNITUDE - in->x)) { 423 psError(PS_ERR_UNKNOWN,true,"out->x is %lf, should be %lf", 424 out->x, in->x + COLOR + MAGNITUDE); 425 return 2; 422 426 } 423 //printf("psPlaneTransformApply(): (%f, %f) -> (%f, %f)\n", in.x, in.y, out.x, out.y); 424 } 425 426 printf("-------------------------------------------------------------------\n"); 427 printf("Calling psPlaneDistortApply() with NULL psPlaneDistort. Should generate error, return NULL.\n"); 428 rc = psPlaneDistortApply(NULL, NULL, &in, COLOR, MAGNITUDE); 427 if (FLT_EPSILON < fabs(out->y - COLOR - MAGNITUDE - in->y)) { 428 psError(PS_ERR_UNKNOWN,true,"out->y is %lf, should be %lf", 429 out->y, in->y + COLOR + MAGNITUDE); 430 return 3; 431 } 432 } 433 psFree(out); 434 435 // Attempt to invoke psPlaneDistortApply with NULL psPlaneDistort 436 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for null psPlaneDistort"); 437 rc = psPlaneDistortApply(NULL, NULL, in, COLOR, MAGNITUDE); 429 438 if (rc != NULL) { 430 printf("TEST ERROR: psPlaneDistortApply() did not return NULL.\n"); 431 testStatus = false; 432 rc = NULL; 433 } 434 435 printf("-------------------------------------------------------------------\n"); 436 printf("Calling psPlaneDistortApply() with NULL psPlaneDistort->x. Should generate error, return NULL.\n"); 437 tmp4DPoly = pt.x; 438 pt.x = NULL; 439 rc = psPlaneDistortApply(NULL, &pt, &in, COLOR, MAGNITUDE); 439 psError(PS_ERR_UNKNOWN,true,"Did not return NULL."); 440 return 4; 441 } 442 443 // Attempt to invoke psPlaneDistortApply with NULL psPlaneDistort x member 444 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for null x member psPlaneDistort"); 445 tmp4DPoly = pt->x; 446 pt->x = NULL; 447 rc = psPlaneDistortApply(NULL, pt, in, COLOR, MAGNITUDE); 440 448 if (rc != NULL) { 441 printf("TEST ERROR: psPlaneDistortApply() did not return NULL.\n"); 442 testStatus = false; 443 rc = NULL; 444 } 445 pt.x = tmp4DPoly; 446 447 printf("-------------------------------------------------------------------\n"); 448 printf("Calling psPlaneDistortApply() with NULL psPlaneDistort->y. Should generate error, return NULL.\n"); 449 tmp4DPoly = pt.y; 450 pt.y = NULL; 451 rc = psPlaneDistortApply(NULL, &pt, &in, COLOR, MAGNITUDE); 449 psError(PS_ERR_UNKNOWN,true,"Did not return NULL."); 450 return 5; 451 } 452 pt->x = tmp4DPoly; 453 454 // Attempt to invoke psPlaneDistortApply with NULL psPlaneDistort y member 455 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for null y member psPlaneDistort"); 456 tmp4DPoly = pt->y; 457 pt->y = NULL; 458 rc = psPlaneDistortApply(NULL, pt, in, COLOR, MAGNITUDE); 452 459 if (rc != NULL) { 453 printf("TEST ERROR: psPlaneDistortApply() did not return NULL.\n"); 454 testStatus = false; 455 rc = NULL; 456 } 457 pt.y = tmp4DPoly; 458 459 printf("-------------------------------------------------------------------\n"); 460 printf("Calling psPlaneDistortApply() with NULL input coords. Should generate error, return NULL.\n"); 461 rc = psPlaneDistortApply(NULL, &pt, NULL, COLOR, MAGNITUDE); 460 psError(PS_ERR_UNKNOWN,true,"Did not return NULL."); 461 return 6; 462 } 463 pt->y = tmp4DPoly; 464 465 // Attempt to invoke psPlaneDistortApply with NULL input psPlane 466 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for null input psPlane"); 467 rc = psPlaneDistortApply(NULL, pt, NULL, COLOR, MAGNITUDE); 462 468 if (rc != NULL) { 463 printf("TEST ERROR: psPlaneDistortApply() did not return NULL.\n"); 464 testStatus = false; 465 rc = NULL; 466 } 467 468 469 470 printf("-------------------------------------------------------------------\n"); 471 psFree(pt.x); 472 psFree(pt.y); 473 return(testStatus); 469 psError(PS_ERR_UNKNOWN,true,"Did not return NULL"); 470 return 7; 471 } 472 473 psFree(pt); 474 psFree(in); 475 476 return 0; 474 477 } 475 478 -
trunk/psLib/test/astronomy/verified/tst_psCoord.stderr
r3431 r3432 81 81 \**********************************************************************************/ 82 82 83 <DATE><TIME>|<HOST>|I|testPlaneDistortApply 84 Following should generate an error message for null psPlaneDistort 83 85 <DATE><TIME>|<HOST>|E|psPlaneDistortApply (FILE:LINENO) 84 86 Unallowable operation: transform is NULL. 87 <DATE><TIME>|<HOST>|I|testPlaneDistortApply 88 Following should generate an error message for null x member psPlaneDistort 85 89 <DATE><TIME>|<HOST>|E|psPlaneDistortApply (FILE:LINENO) 86 90 Unallowable operation: transform->x is NULL. 91 <DATE><TIME>|<HOST>|I|testPlaneDistortApply 92 Following should generate an error message for null y member psPlaneDistort 87 93 <DATE><TIME>|<HOST>|E|psPlaneDistortApply (FILE:LINENO) 88 94 Unallowable operation: transform->y is NULL. 95 <DATE><TIME>|<HOST>|I|testPlaneDistortApply 96 Following should generate an error message for null input psPlane 89 97 <DATE><TIME>|<HOST>|E|psPlaneDistortApply (FILE:LINENO) 90 98 Unallowable operation: coords is NULL. -
trunk/psLib/test/astronomy/verified/tst_psCoord.stdout
r3431 r3432 1 -------------------------------------------------------------------2 Calling psPlaneDistortApply() with NULL psPlaneDistort. Should generate error, return NULL.3 -------------------------------------------------------------------4 Calling psPlaneDistortApply() with NULL psPlaneDistort->x. Should generate error, return NULL.5 -------------------------------------------------------------------6 Calling psPlaneDistortApply() with NULL psPlaneDistort->y. Should generate error, return NULL.7 -------------------------------------------------------------------8 Calling psPlaneDistortApply() with NULL input coords. Should generate error, return NULL.9 -------------------------------------------------------------------10 1 ------------------------------------------------------------------- 11 2 Calling psSphereGetOffset() with NULL position1. Should generate error, return NULL.
Note:
See TracChangeset
for help on using the changeset viewer.
