Changeset 17529 for trunk/psLib/test/math
- Timestamp:
- May 5, 2008, 11:04:24 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/math/tap_psHistogram.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/math/tap_psHistogram.c
r13127 r17529 134 134 skip_start(myHist == NULL, 1, "Skipping tests because psVectorHistogram() returned NULL"); 135 135 136 // we need to explicitly count the number in each bin. we can fool ourselves with rounding 137 // otherwise 138 136 139 bool errorFlag = false; 137 for (int i = 0;i < numBins;i++) { 138 if (fabs(myHist->nums->data.F32[i] - (NUM_DATA/numBins)) > ERROR_TOLERANCE) { 139 diag("Bin number %d bounds: (%.2f - %.2f) data (%.2f) should be (%.2f)\n", 140 i, 141 myHist->bounds->data.F32[i], 142 myHist->bounds->data.F32[i + 1], 143 myHist->nums->data.F32[i], (float) (NUM_DATA/numBins)); 144 errorFlag = true; 145 } 140 for (int i = 0; i < numBins; i++) { 141 int nValues = 0; 142 for (int j = 0; j < myData->n; j++) { 143 // XXX EAM : need to get rules right. which boundary is inclusive, which is exclusive? 144 if (myData->data.F32[j] <= myHist->bounds->data.F32[i]) continue; 145 if (myData->data.F32[j] > myHist->bounds->data.F32[i+1]) continue; 146 nValues ++; 147 } 148 if (myHist->nums->data.F32[i] != nValues) { 149 diag("Bin number %d bounds: (%.2f - %.2f) data (%.2f) should be (%2d)\n", 150 i, 151 myHist->bounds->data.F32[i], 152 myHist->bounds->data.F32[i+1], 153 myHist->nums->data.F32[i], nValues); 154 errorFlag = true; 155 } 146 156 } 147 157 ok(!errorFlag, "psVectorHistogram() correctly set the histogram");
Note:
See TracChangeset
for help on using the changeset viewer.
