Changeset 13306 for trunk/psLib/test/mathtypes
- Timestamp:
- May 7, 2007, 8:30:16 PM (19 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
r13123 r13306 2 2 #include <string.h> 3 3 #include <pslib.h> 4 5 4 #include "tap.h" 6 5 #include "pstap.h" … … 10 9 psLogSetFormat("HLNM"); 11 10 psLogSetLevel(PS_LOG_INFO); 12 plan_tests(2 85);11 plan_tests(294); 13 12 14 13 … … 596 595 597 596 // psVectorCountPixelMask() tests 597 // Ensure -1 return for NULL psVector input 598 598 { 599 599 psMemId id = psMemGetId(); 600 600 ok(psVectorCountPixelMask(NULL, 1) == -1, 601 "psVectorCountPixelMask returned -1 for NULL Vector input"); 602 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 603 } 604 605 601 "psVectorCountPixelMask() returned -1 for NULL psVector input"); 602 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 603 } 604 605 606 // Ensure -1 return for incorrect TYPE psVector input 606 607 { 607 608 psMemId id = psMemGetId(); … … 613 614 vec->data.S32[4] = 0; 614 615 ok(psVectorCountPixelMask(vec, 1) == -1, 615 "returned -1 for wrong type of Vector input"); 616 psFree(vec); 617 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 618 } 619 620 616 "psVectorCountPixelMask() returned -1 for incorrect TYPE psVector input"); 617 psFree(vec); 618 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 619 } 620 621 622 // Use correct inputs 621 623 { 622 624 psMemId id = psMemGetId(); … … 628 630 vec->data.U8[4] = 0; 629 631 long numPix = psVectorCountPixelMask(vec, 1); 630 ok(numPix != -1, " did not return -1 for correctVector input");632 ok(numPix != -1, "psVectorCountPixelMask() did return -1 for correct psVector input"); 631 633 ok(numPix == 2, "returned pixel count %d", numPix); 634 psFree(vec); 635 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 636 } 637 638 639 // Use correct inputs; psVector length of 0 640 { 641 psMemId id = psMemGetId(); 642 psVector *vec = psVectorAlloc(0, PS_TYPE_U8); 643 long numPix = psVectorCountPixelMask(vec, 1); 644 ok(numPix != -1, "psVectorCountPixelMask() did return -1 for correct psVector input (length 0)"); 645 ok(numPix == 0, "returned pixel count %d", numPix); 646 psFree(vec); 647 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 648 } 649 650 651 // Use correct inputs; psVector length of 1 652 { 653 psMemId id = psMemGetId(); 654 psVector *vec = psVectorAlloc(1, PS_TYPE_U8); 655 vec->data.U8[0] = 0; 656 long numPix = psVectorCountPixelMask(vec, 1); 657 ok(numPix != -1, "psVectorCountPixelMask() did return -1 for correct psVector input (length 1)"); 658 ok(numPix == 0, "returned pixel count %d", numPix); 659 psFree(vec); 660 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 661 } 662 663 664 // Use correct inputs; large psVector 665 { 666 psMemId id = psMemGetId(); 667 #define N 10 668 psVector *vec = psVectorAlloc(N, PS_TYPE_U8); 669 for (int i = 0 ; i < N ; i++) { 670 if (0 == i%2) { 671 vec->data.U8[i] = 0; 672 } else { 673 vec->data.U8[i] = 1; 674 } 675 } 676 long numPix = psVectorCountPixelMask(vec, 1); 677 ok(numPix != -1, "psVectorCountPixelMask() did return -1 for correct psVector input (length: %d)", N); 678 ok(numPix == N/2, "returned pixel count %d", numPix); 632 679 psFree(vec); 633 680 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
Note:
See TracChangeset
for help on using the changeset viewer.
