Changeset 5656
- Timestamp:
- Dec 1, 2005, 2:51:48 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/mathtypes/tst_psVector.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/mathtypes/tst_psVector.c
r5137 r5656 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $17 * @date $Date: 2005- 09-26 22:35:54$16 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2005-12-02 00:51:48 $ 18 18 * 19 19 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 29 29 static psS32 testVectorInit(void); 30 30 static psS32 testVectorCreate(void); 31 static psS32 testVectorCreateA(void); 32 static psS32 testVectorCreateB(void); 31 33 static psS32 testVectorGetSet(void); 32 34 static psS32 testVectorCountPixelMask(void); … … 38 40 {testVectorInit,-4,"psVectorInit",0,false}, 39 41 {testVectorCreate,-5,"psVectorCreate",0,false}, 40 {testVectorGetSet,-6,"psVectorGet/Set",0,false}, 41 {testVectorCountPixelMask,-7,"psVectorCountPixelMask",0,false}, 42 {testVectorCreateA,-6,"psVectorCreateA",0,false}, 43 {testVectorCreateB,-7,"psVectorCreateB",0,false}, 44 {testVectorGetSet,-8,"psVectorGet/Set",0,false}, 45 {testVectorCountPixelMask,-9,"psVectorCountPixelMask",0,false}, 42 46 {NULL} 43 47 }; … … 371 375 psVector *test2 = NULL; 372 376 psVector *input = NULL; 373 psVector *input2 = psVectorAlloc(5, PS_TYPE_F 64);377 psVector *input2 = psVectorAlloc(5, PS_TYPE_F32); 374 378 375 379 test = psVectorCreate(input, 0.0, 10.0, 1.0, PS_TYPE_S32); … … 392 396 return 0; 393 397 } 394 398 psS32 testVectorCreateA(void) 399 { 400 // 401 // Test PS_TYPE_F64 402 // PS_TYPE_S64 403 // 404 psVector *test = NULL; 405 psVector *test2 = NULL; 406 psVector *input = NULL; 407 psVector *input2 = psVectorAlloc(5, PS_TYPE_F64); 408 409 test = psVectorCreate(input, 0.0, 10.0, 1.0, PS_TYPE_S64); 410 test2 = psVectorCreate(input2, 0.0, 5.0, 0.5, PS_TYPE_F64); 411 412 for (int i = 0; i < 10; i++) { 413 if (test->data.S64[i] != i) { 414 fprintf(stderr, "Vector data does not match. i = %d, data=%ld\n", 415 i, (long)test->data.S64[i]); 416 return 1; 417 } 418 if (test2->data.F64[i] != i*0.5) { 419 fprintf(stderr, "Vector data does not match. i = %d, data=%f\n", 420 i, test->data.F64[i]); 421 return 1; 422 } 423 } 424 psFree(test); 425 psFree(test2); 426 return 0; 427 } 428 psS32 testVectorCreateB(void) 429 { 430 // 431 // Test PS_TYPE_U16 432 // PS_TYPE_S16 433 // 434 psVector *test = NULL; 435 psVector *test2 = NULL; 436 psVector *input = NULL; 437 psVector *input2 = psVectorAlloc(5, PS_TYPE_U16); 438 439 test = psVectorCreate(input, 0.0, 10.0, 1.0, PS_TYPE_S16); 440 test2 = psVectorCreate(input2, 0.0, 20.0, 2.0, PS_TYPE_U16); 441 442 for (int i = 0; i < 10; i++) { 443 if (test->data.S16[i] != i) { 444 fprintf(stderr, "Vector data does not match. i = %d, data=%d\n", 445 i, test->data.S16[i]); 446 return 1; 447 } 448 if (test2->data.U16[i] != i*2.0) { 449 fprintf(stderr, "Vector data does not match. i = %d, data=%d\n", 450 i, test->data.U16[i]); 451 return 1; 452 } 453 } 454 psFree(test); 455 psFree(test2); 456 return 0; 457 } 395 458 psS32 testVectorGetSet(void) 396 459 {
Note:
See TracChangeset
for help on using the changeset viewer.
