Changeset 7789
- Timestamp:
- Jul 1, 2006, 5:23:51 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/mathtypes/tap_psVector.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/mathtypes/tap_psVector.c
r7788 r7789 5 5 int main (void) 6 6 { 7 plan_tests(13 1);7 plan_tests(136); 8 8 9 9 diag("psVectorAlloc() tests"); … … 391 391 { 392 392 ok(psVectorCountPixelMask(NULL, 1) == -1, 393 "psVectorCountPixelMask returned -1 for NULL Vector input .");393 "psVectorCountPixelMask returned -1 for NULL Vector input"); 394 394 } 395 395 … … 404 404 405 405 ok(psVectorCountPixelMask(vec, 1) == -1, 406 "returned -1 for wrong type of Vector input .");407 408 psFree(vec); 409 } 410 411 { 412 psVector *vec = vec =psVectorAlloc(5, PS_TYPE_U8);406 "returned -1 for wrong type of Vector input"); 407 408 psFree(vec); 409 } 410 411 { 412 psVector *vec = psVectorAlloc(5, PS_TYPE_U8); 413 413 vec->data.U8[0] = 0; 414 414 vec->data.U8[1] = 1; … … 419 419 long numPix = psVectorCountPixelMask(vec, 1); 420 420 421 ok(numPix != -1, "returned -1 for correct Vector input\n"); 422 ok(numPix == 2, "returned pixel count %d\n", numPix); 423 424 psFree(vec); 421 ok(numPix != -1, "returned -1 for correct Vector input"); 422 ok(numPix == 2, "returned pixel count %d", numPix); 423 424 psFree(vec); 425 } 426 427 428 diag("psVectorLength() tests"); 429 430 { 431 psVector *vector = psVectorAlloc(5, PS_TYPE_F32); 432 433 ok(psVectorLength(vector) == 0, 434 "returned the correct length of vector"); 435 436 psFree(vector); 437 } 438 439 { 440 psVector *vector = psVectorAlloc(5, PS_TYPE_F32); 441 vector->n = 5; 442 443 ok(psVectorLength(vector) == 5, 444 "returned the correct length of vector"); 445 446 psFree(vector); 447 } 448 449 { 450 psVector *vector = psVectorAlloc(6, PS_TYPE_F32); 451 vector->n = 6; 452 453 ok(psVectorLength(vector) == 6, 454 "returned the correct length of vector"); 455 456 psFree(vector); 457 } 458 459 { 460 ok(psVectorLength(NULL) == -1, "returned -1 for a NULL input vector"); 461 } 462 463 { 464 psArray *array = psArrayAlloc(5); 465 466 ok(psVectorLength((psVector*)array) == -1, 467 "returned-1 for an invalid input vector"); 468 469 psFree(array); 425 470 } 426 471 … … 429 474 430 475 # if 0 431 432 psS32 testVectorLength( void )433 {434 psVector *vector = psVectorAlloc(5, PS_TYPE_F32);435 436 if (psVectorLength(vector) != 0) {437 psError(PS_ERR_BAD_PARAMETER_VALUE, false,438 "psVectorLength failed to return the correct length of vector.\n");439 return 1;440 }441 vector->n = 5;442 if (psVectorLength(vector) != 5) {443 psError(PS_ERR_BAD_PARAMETER_VALUE, false,444 "psVectorLength failed to return the correct length of vector.\n");445 return 2;446 }447 vector->n++;448 if (psVectorLength(vector) != 6) {449 psError(PS_ERR_BAD_PARAMETER_VALUE, false,450 "psVectorLength failed to return the correct length of vector.\n");451 return 3;452 }453 psFree(vector);454 455 psVector *emptyVector = NULL;456 psArray *array = psArrayAlloc(5);457 458 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");459 if (psVectorLength(emptyVector) != -1) {460 psError(PS_ERR_BAD_PARAMETER_VALUE, false,461 "psVectorLength failed to return -1 for a NULL input vector.\n");462 return 4;463 }464 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");465 if (psVectorLength((psVector*)array) != -1) {466 psError(PS_ERR_BAD_PARAMETER_VALUE, false,467 "psVectorLength failed to return -1 for an invalid input vector.\n");468 return 5;469 }470 psFree(array);471 472 return 0;473 }474 476 475 477 psS32 testVectorCopy(void)
Note:
See TracChangeset
for help on using the changeset viewer.
