Changeset 893 for trunk/psLib/test/dataManip/tst_psStats00.c
- Timestamp:
- Jun 6, 2004, 5:14:39 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/dataManip/tst_psStats00.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/dataManip/tst_psStats00.c
r887 r893 11 11 { 12 12 psStats *myStats = NULL; 13 psStats *myStats2 = NULL; 13 14 int testStatus = true; 14 15 int globalTestStatus = true; … … 51 52 } 52 53 } 54 55 53 56 realMeanNoMask /= (float) N; 54 57 realMeanWithMask /= (float) count; … … 78 81 79 82 /*************************************************************************/ 80 /* Call psVectorStats() with vector mask .*/81 /*************************************************************************/ 82 printPositiveTestHeader(stdout, 83 "psStats functions", 84 "PS_STAT_SAMPLE_MEAN: with vector mask ");83 /* Call psVectorStats() with vector mask=1. */ 84 /*************************************************************************/ 85 printPositiveTestHeader(stdout, 86 "psStats functions", 87 "PS_STAT_SAMPLE_MEAN: with vector mask=1"); 85 88 86 89 myStats = psVectorStats(myStats, myVector, maskVector, 1); … … 97 100 printFooter(stdout, 98 101 "psVector functions", 99 "PS_STAT_SAMPLE_MEAN: with vector mask", 100 testStatus); 101 102 /*************************************************************************/ 103 /* Deallocate data structures */ 102 "PS_STAT_SAMPLE_MEAN: with vector mask=1", 103 testStatus); 104 105 /*************************************************************************/ 106 /* Call psVectorStats() with vector mask=2. */ 107 /*************************************************************************/ 108 printPositiveTestHeader(stdout, 109 "psStats functions", 110 "PS_STAT_SAMPLE_MEAN: with vector mask=2"); 111 112 // Set the mask vector and calculate the expected maximum. 113 // Set the mask vector. 114 for (i=0;i<N;i++) { 115 if (maskVector->data.U8[i] == 1) { 116 maskVector->data.U8[i] = 2; 117 } 118 } 119 120 myStats = psVectorStats(myStats, myVector, maskVector, 2); 121 mean = myStats->sampleMean; 122 printf("Called psVectorStats() on a vector with last N/2 elements masked.\n"); 123 printf("The expected mean was %f; the calculated mean was %f\n", realMeanWithMask, mean); 124 if (mean == realMeanWithMask) { 125 testStatus = true; 126 } else { 127 testStatus = false; 128 globalTestStatus = false; 129 } 130 131 printFooter(stdout, 132 "psVector functions", 133 "PS_STAT_SAMPLE_MEAN: with vector mask=2", 134 testStatus); 135 136 /*************************************************************************/ 137 /* Call psVectorStats() with vector mask=3. */ 138 /*************************************************************************/ 139 printPositiveTestHeader(stdout, 140 "psStats functions", 141 "PS_STAT_SAMPLE_MEAN: with vector mask=3"); 142 143 // Set the mask vector and calculate the expected maximum. 144 // Set the mask vector. 145 for (i=0;i<N;i++) { 146 if (maskVector->data.U8[i] == 2) { 147 maskVector->data.U8[i] = 3; 148 } 149 } 150 151 myStats = psVectorStats(myStats, myVector, maskVector, 3); 152 mean = myStats->sampleMean; 153 printf("Called psVectorStats() on a vector with last N/2 elements masked.\n"); 154 printf("The expected mean was %f; the calculated mean was %f\n", realMeanWithMask, mean); 155 if (mean == realMeanWithMask) { 156 testStatus = true; 157 } else { 158 testStatus = false; 159 globalTestStatus = false; 160 } 161 162 printFooter(stdout, 163 "psVector functions", 164 "PS_STAT_SAMPLE_MEAN: with vector mask=3", 165 testStatus); 166 /*************************************************************************/ 167 /* Call psVectorStats() with NULL inputs. */ 168 /*************************************************************************/ 169 printPositiveTestHeader(stdout, 170 "psStats functions", 171 "PS_STAT_SAMPLE_MEAN: NULL inputs"); 172 173 myStats = psVectorStats(myStats, NULL, NULL, 0); 174 myStats2 = psVectorStats(NULL, myVector, NULL, 0); 175 176 printFooter(stdout, 177 "psVector functions", 178 "PS_STAT_SAMPLE_MEAN: NULL inputs", 179 testStatus); 180 181 /*************************************************************************/ 182 /* Deallocate data structures */ 104 183 /*************************************************************************/ 105 184 printPositiveTestHeader(stdout,
Note:
See TracChangeset
for help on using the changeset viewer.
