Changeset 9082 for trunk/psLib/test/types
- Timestamp:
- Sep 30, 2006, 2:40:35 PM (20 years ago)
- Location:
- trunk/psLib/test/types
- Files:
-
- 5 edited
-
Makefile.am (modified) (3 diffs)
-
execute_tap (modified) (1 diff)
-
tap_psBitSet_all.c (modified) (5 diffs)
-
tap_psHash_all.c (modified) (1 diff)
-
tap_psList_all.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/types/Makefile.am
r8960 r9082 24 24 tap_psMetadata_polynomials \ 25 25 tap_psArray_all \ 26 tap_psArguments_all 26 tap_psArguments_all \ 27 tap_psPixels_all \ 28 tap_psHash_all \ 29 tap_psBitSet_all \ 30 tap_psList_all 27 31 28 32 if BUILD_TESTS … … 42 46 data/test3.config \ 43 47 data/test4.config \ 44 data/test5.config 48 data/test5.config 45 49 46 50 tmp_files = \ … … 53 57 test3.config \ 54 58 test4.config \ 55 test5.config 59 test5.config 56 60 57 61 CLEANFILES = $(tmp_files) multi.fits table.fits temp/* MDCopy.in MDCopy.out mdcfgwrt.out \ -
trunk/psLib/test/types/execute_tap
r8966 r9082 15 15 ./tap_psPixels_all 16 16 ./tap_psHash_all 17 ./tap_psBitSet_all 18 ./tap_psList_all -
trunk/psLib/test/types/tap_psBitSet_all.c
r8930 r9082 12 12 13 13 #include <pslib.h> 14 #include <string.h> 14 15 15 16 #include "tap.h" … … 21 22 int main(void) 22 23 { 23 plan_tests( 5);24 plan_tests(31); 24 25 25 26 diag("Tests for psBitSet Functions"); … … 50 51 "psBitSetAlloc: return properly allocated psBitSet."); 51 52 } 53 //Return properly allocated psBitSet 54 { 55 psFree(bs); 56 bs = psBitSetAlloc(8); 57 ok( bs != NULL && psMemCheckBitSet(bs) && bs->n == 1, 58 "psBitSetAlloc: return properly allocated psBitSet."); 59 } 52 60 //Make sure psMemCheckBitSet works correctly - return false 53 61 { … … 56 64 "psMemCheckBitSet: return false for non-BitSet input."); 57 65 } 58 //Return properly allocated psBitSet 59 { 60 psFree(bs); 61 bs = psBitSetAlloc(8); 62 ok( bs != NULL && psMemCheckBitSet(bs) && bs->n == 1, 63 "psBitSetAlloc: return properly allocated psBitSet."); 64 } 66 67 //BitSetSet Tests 68 //Return NULL for NULL input psBitSet 69 { 70 noBits = psBitSetSet(noBits, 0); 71 ok( noBits == NULL, 72 "psBitSetSet: return NULL for NULL BitSet input."); 73 } 74 //Return input BitSet for negative bit input 75 { 76 noBits = psBitSetSet(bs, -1); 77 ok( noBits == bs, 78 "psBitSetSet: return input BitSet for negative bits input."); 79 noBits = NULL; 80 } 81 //Return input BitSet for out-of-range bits 82 { 83 noBits = psBitSetSet(bs, 8); 84 ok( noBits == bs, 85 "psBitSetSet: return input BitSet for out-of-range bits input."); 86 noBits = NULL; 87 } 88 //Return set BitSet for valid inputs 89 { 90 bs = psBitSetSet(bs, 2); 91 ok( bs->bits[0] == 4, 92 "psBitSetSet: return properly set BitSet for valid inputs."); 93 } 94 95 //BitSetClear Tests 96 //Return NULL for NULL input psBitSet 97 { 98 noBits = psBitSetClear(noBits, 0); 99 ok( noBits == NULL, 100 "psBitSetClear: return NULL for NULL BitSet input."); 101 } 102 //Return input BitSet for negative bit input 103 { 104 noBits = psBitSetClear(bs, -1); 105 ok( noBits == bs, 106 "psBitSetClear: return input BitSet for negative bits input."); 107 noBits = NULL; 108 } 109 //Return input BitSet for out-of-range bits 110 { 111 noBits = psBitSetClear(bs, 8); 112 ok( noBits == bs, 113 "psBitSetClear: return input BitSet for out-of-range bits input."); 114 noBits = NULL; 115 } 116 //Return cleared BitSet for valid inputs 117 { 118 bs = psBitSetClear(bs, 2); 119 ok( bs->bits[0] == 0, 120 "psBitSetClear: return properly cleared BitSet for valid inputs."); 121 } 122 123 //BitSetTest Tests 124 //Return false for NULL input psBitSet 125 { 126 ok( !psBitSetTest(noBits, 0), 127 "psBitSetTest: return false for NULL BitSet input."); 128 } 129 //Return false for negative bit input 130 { 131 ok( !psBitSetTest(bs, -1), 132 "psBitSetTest: return false for negative bits input."); 133 } 134 //Return false for out-of-range bits 135 { 136 ok( !psBitSetTest(bs, 8), 137 "psBitSetTest: return false for out-of-range bits input."); 138 } 139 //Return false for non-matching bit in BitSet 140 { 141 ok( !psBitSetTest(bs, 2), 142 "psBitSetTest: return false for non-matching bit in BitSet."); 143 } 144 //Return false for non-matching bit in BitSet 145 { 146 bs = psBitSetSet(bs, 2); 147 ok( psBitSetTest(bs, 2), 148 "psBitSetTest: return true for matching bit in BitSet."); 149 } 150 65 151 66 152 //Check for Memory leaks … … 74 160 { 75 161 diag(" >>>Test 2: psBitSet Operation Fxns"); 162 psBitSet *noBits = NULL; 163 psBitSet *bs = NULL; 164 bs = psBitSetAlloc(8); 165 bs = psBitSetSet(bs, 2); // 0000 0100 == 4 166 bs = psBitSetSet(bs, 3); // 0000 1100 == 12 167 bs = psBitSetSet(bs, 4); // 0001 1100 == 28 168 bs = psBitSetSet(bs, 5); // 0011 1100 == 60 169 bs = psBitSetSet(bs, 6); // 0111 1100 == 124 170 bs = psBitSetSet(bs, 7); // 1111 1100 == 252 171 psBitSet *out = NULL; 172 173 //psBitSetNot Tests 174 //Return NULL for NULL BitSet input 175 { 176 out = psBitSetNot(out, noBits); 177 ok( out == NULL, 178 "psBitSetNot: return NULL for NULL BitSet input."); 179 } 180 //Return correct BitSet for valid BitSet input 181 { 182 out = psBitSetNot(out, bs); //bs = 1111 1100 so out should = 0000 0011 = 3 183 ok( out->bits[0] == 3, 184 "psBitSetNot: return correct BitSet for valid BitSet input."); 185 } 186 187 //psBitSetOp Tests out = psBitSetOp(out, bs1, "op", bs2); 188 //Return NULL for NULL BitSet input 189 { 190 psFree(out); 191 out = NULL; 192 out = psBitSetOp(out, noBits, "op", noBits); 193 ok( out == NULL, 194 "psBitSetOp: return NULL for NULL BitSet input."); 195 } 196 //Return NULL for NULL operator input 197 { 198 out = psBitSetOp(out, bs, NULL, noBits); 199 ok( out == NULL, 200 "psBitSetOp: return NULL for NULL operator input."); 201 } 202 //Return NULL for invalid operator input 203 { 204 out = psBitSetOp(out, bs, "XAND", noBits); 205 ok( out == NULL, 206 "psBitSetOp: return NULL for invalid operator input."); 207 } 208 //Return NULL for AND operator with NULL second BitSet input 209 { 210 out = psBitSetOp(out, bs, "AND", noBits); 211 ok( out == NULL, 212 "psBitSetOp: return NULL for AND operator with NULL second BitSet input."); 213 } 214 //Return NULL for AND operator with BitSet inputs of differing size. 215 psBitSet *bs2 = psBitSetAlloc(16); 216 { 217 out = psBitSetOp(out, bs, "AND", bs2); 218 ok( out == NULL, 219 "psBitSetOp: return NULL for AND operator with BitSet inputs of" 220 " differing size."); 221 } 222 psFree(bs); 223 bs = psBitSetAlloc(16); 224 bs = psBitSetSet(bs, 1); // 0000 0010 == 2 225 bs2 = psBitSetSet(bs2, 2); // 0000 0100 == 4 226 //Return correct psBitSet output for valid inputs with AND operator 227 { 228 out = psBitSetOp(out, bs, "AND", bs2); 229 ok( out->bits[0] == 0, 230 "psBitSetOp: return correct psBitSet output for valid inputs" 231 " with AND operator."); 232 } 233 //Return correct psBitSet output for valid inputs with OR operator 234 { 235 out = psBitSetOp(out, bs, "OR", bs2); 236 ok( out->bits[0] == 6, 237 "psBitSetOp: return correct psBitSet output for valid inputs" 238 " with OR operator."); 239 } 240 //Return correct psBitSet output for valid inputs with XOR operator 241 bs2 = psBitSetSet(bs2, 1); // 0000 0110 == 6 242 { 243 out = psBitSetOp(out, bs, "XOR", bs2); 244 ok( out->bits[0] == 4, 245 "psBitSetOp: return correct psBitSet output for valid inputs" 246 " with XOR operator."); 247 } 248 //Return correct psBitSet output for valid inputs with NOT operator 249 { 250 psFree(out); 251 out = psBitSetAlloc(0); 252 bs = psBitSetSet(bs, 2); // 0000 0110 == 4 253 bs = psBitSetSet(bs, 3); // 0000 1110 == 12 254 bs = psBitSetSet(bs, 4); // 0001 1110 == 28 255 bs = psBitSetSet(bs, 5); // 0011 1110 == 60 256 bs = psBitSetSet(bs, 6); // 0111 1110 == 124 257 bs = psBitSetSet(bs, 7); // 1111 1110 == 252 258 out = psBitSetOp(out, bs, "NOT", bs2); 259 ok( out->bits[0] == 1, 260 "psBitSetOp: return correct psBitSet output for valid inputs" 261 " with NOT operator."); 262 } 263 264 //psBitSetToString Tests 265 //Return NULL for NULL BitSet input 266 psString bitStr = NULL; 267 { 268 bitStr = psBitSetToString(noBits); 269 ok( bitStr == NULL, 270 "psBitSetToString: return NULL for NULL BitSet input."); 271 } 272 //Return correct string for valid BitSet input 273 { 274 psFree(bs); 275 bs = psBitSetAlloc(8); 276 bs = psBitSetSet(bs, 2); // 0000 0100 == 4 277 bitStr = psBitSetToString(bs); 278 ok( !strncmp(bitStr, "00000100", 10), 279 "psBitSetToString: return correct string for valid BitSet input."); 280 } 76 281 77 282 78 283 //Check for Memory leaks 79 284 { 285 psFree(bitStr); 286 psFree(out); 287 psFree(bs); 288 psFree(bs2); 80 289 checkMem(); 81 290 } 82 291 } 83 84 /*85 //Attempt to reallocate the psArray - smaller86 {87 skip_start( !psArraySet(a, 0, s32) || !psArraySet(a, 1, s32), 1,88 "Skipping 1 tests because psArraySet failed");89 ok( a->n == 1 && a->nalloc == 1 && *s32_2 == 1,90 "psArrayRealloc: return properly reallocated psArray.");91 skip_end();92 }93 94 */95 -
trunk/psLib/test/types/tap_psHash_all.c
r8966 r9082 12 12 13 13 #include <pslib.h> 14 #include <string.h> 14 15 15 16 #include "tap.h" -
trunk/psLib/test/types/tap_psList_all.c
r8966 r9082 12 12 13 13 #include <pslib.h> 14 #include <string.h> 14 15 15 16 #include "tap.h"
Note:
See TracChangeset
for help on using the changeset viewer.
