 Timestamp:
 06/29/10 10:18:42 (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/components/lociplugins/test/loci/plugins/in/ImporterTest.java
r6590 r6591 55 55 // colorized: 1/1/indexed (all indices 0 for all images), 3/1/indexed (iIndex,cIndex) (although w/ falseColor its okay), 56 56 // 6/3/nonindexed (iIndex,cIndex), 12/3/nonindexed (iIndex,cIndex), 3/3/indexed (iIndex,cIndex) 57 // concat and split (returns wrong number of images per imp)58 57 // record does not work 59 58 … … 75 74 // waiting on BF implementations for 76 75 //  indexed color support 77 //  changes to concat78 76 79 77 // must address before release … … 87 85 // custom 88 86 //  add some tests for combination of options 89 // comboConcatSplit()  done but notpassing87 // comboConcatSplit()  done and passing 90 88 // comboManyOptions  done and passing 91 89 // other combo tests  rely on color code working. Waiting for BF. … … 1161 1159 ImagePlus imp = imps[0]; 1162 1160 1163 // TODO 1164 // BF right now does not scale one of z/c/t by s. So z*c*t != stacksize. IJ handles by reordering dimensions as 1165 // 1x1xnSlices. Once BF is updated to specify which dimension to concat along then uncomment a modified version 1166 // of the next test. 1167 //xyzctTest(x,y,z,c,t); // this test but one of z,c,t scaled by s 1161 // with FakeFiles all dims compatible for concat, BF will concat along T. Thus t*s in next test. 1162 xyzctTest(imp,x,y,z,c,t*s); 1168 1163 1169 1164 multipleSeriesInZtcOrderTest(imp,s,z,c,t); … … 1508 1503 1509 1504 /** tests BF's options.set?Begin(), options.set?End(), and options.set?Step() */ 1510 private void memorySpecifyRangeTester( int z, int c, int t,1505 private void memorySpecifyRangeTester(boolean virtual, int z, int c, int t, 1511 1506 int zFrom, int zTo, int zBy, 1512 1507 int cFrom, int cTo, int cBy, … … 1521 1516 try { 1522 1517 ImporterOptions options = new ImporterOptions(); 1518 options.setVirtual(virtual); 1523 1519 options.setId(path); 1524 1520 … … 1570 1566 1571 1567 /** tests BF's options.setCrop() and options.setCropRegion() */ 1572 private void memoryCropTester( int x, int y, int ox, int oy, int cropSize)1568 private void memoryCropTester(boolean virtual, int x, int y, int ox, int oy, int cropSize) 1573 1569 { 1574 1570 verifyCropInput(x, y, ox, oy, cropSize); // needed for this test … … 1581 1577 try { 1582 1578 ImporterOptions options = new ImporterOptions(); 1579 options.setVirtual(virtual); 1583 1580 options.setId(path); 1584 1581 options.setCrop(true); … … 2096 2093 public void testMemoryVirtualStack() 2097 2094 { 2098 memoryVirtualStackTester(false);2099 memoryVirtualStackTester(true);2095 for (boolean virtual : BooleanStates) 2096 memoryVirtualStackTester(virtual); 2100 2097 } 2101 2098 … … 2103 2100 public void testMemoryRecordModifications() 2104 2101 { 2105 memoryRecordModificationsTester(false); 2106 memoryRecordModificationsTester(true); 2102 // recordMemory has virtual always set to true. no need to do any other virtual testing 2103 2104 for (boolean rememberChanges : BooleanStates) 2105 memoryRecordModificationsTester(rememberChanges); 2107 2106 } 2108 2107 … … 2112 2111 int z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy; 2113 2112 2114 // test partial z: from 2115 z=8; c=3; t=2; zFrom=2; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2116 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2117 2118 // test partial z: to 2119 z=8; c=3; t=2; zFrom=0; zTo=4; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2120 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2121 2122 // test partial z: by 2123 z=8; c=3; t=2; zFrom=0; zTo=z1; zBy=3; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2124 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2125 2126 // test full z 2127 z=8; c=3; t=2; zFrom=2; zTo=7; zBy=3; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2128 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2129 2130 // test partial c: from 2131 z=6; c=14; t=4; zFrom=0; zTo=z1; zBy=1; cFrom=3; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2132 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2133 2134 // test partial c: to 2135 z=6; c=14; t=4; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=6; cBy=1; tFrom=0; tTo=t1; tBy=1; 2136 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2137 2138 // test partial c: by 2139 z=6; c=14; t=4; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=4; tFrom=0; tTo=t1; tBy=1; 2140 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2141 2142 // test full c 2143 z=6; c=14; t=4; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=12; cBy=4; tFrom=0; tTo=t1; tBy=1; 2144 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2145 2146 // test partial t: from 2147 z=3; c=5; t=13; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=4; tTo=t1; tBy=1; 2148 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2149 2150 // test partial t: to 2151 z=3; c=5; t=13; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=8; tBy=1; 2152 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2153 2154 // test partial t: by 2155 z=3; c=5; t=13; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=2; 2156 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2157 2158 // test full t 2159 z=3; c=5; t=13; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=4; tTo=13; tBy=2; 2160 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2161 2162 // test edge case combo with an invalid by 2163 z=2; c=2; t=2; zFrom=0; zTo=0; zBy=2; cFrom=1; cTo=1; cBy=1; tFrom=0; tTo=1; tBy=1; 2164 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2165 2166 // test a combination of zct's 2167 z=5; c=4; t=6; zFrom=1; zTo=4; zBy=2; cFrom=1; cTo=3; cBy=1; tFrom=2; tTo=5; tBy=2; 2168 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2169 2170 // test another combination of zct's 2171 z=7; c=7; t=7; zFrom=3; zTo=6; zBy=4; cFrom=1; cTo=6; cBy=3; tFrom=0; tTo=2; tBy=2; 2172 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2173 2174 // test bad combination of zct's  choosing beyond ends of ranges 2175 2176 // z index before 0 begin 2177 try { 2178 z=7; c=7; t=7; zFrom=1; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2179 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2180 fail(); 2181 } catch (IllegalArgumentException e) { 2182 assertTrue(true); 2183 } 2184 2185 // z index after z1 end 2186 try { 2187 z=7; c=7; t=7; zFrom=0; zTo=z; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2188 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2189 fail(); 2190 } catch (IllegalArgumentException e) { 2191 assertTrue(true); 2192 } 2193 2194 // z by < 1 2195 try { 2196 z=7; c=7; t=7; zFrom=0; zTo=z1; zBy=0; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2197 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2198 fail(); 2199 } catch (IllegalArgumentException e) { 2200 assertTrue(true); 2201 } 2202 2203 // c index before 0 begin 2204 try { 2205 z=7; c=7; t=7; zFrom=0; zTo=z1; zBy=1; cFrom=1; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2206 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2207 fail(); 2208 } catch (IllegalArgumentException e) { 2209 assertTrue(true); 2210 } 2211 2212 // c index after c1 end 2213 try { 2214 z=7; c=7; t=7; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c; cBy=1; tFrom=0; tTo=t1; tBy=1; 2215 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2216 fail(); 2217 } catch (IllegalArgumentException e) { 2218 assertTrue(true); 2219 } 2220 2221 // c by < 1 2222 try { 2223 z=7; c=7; t=7; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=0; tFrom=0; tTo=t1; tBy=1; 2224 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2225 fail(); 2226 } catch (IllegalArgumentException e) { 2227 assertTrue(true); 2228 } 2229 2230 // t index before 0 begin 2231 try { 2232 z=7; c=7; t=7; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=1; tTo=t1; tBy=1; 2233 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2234 fail(); 2235 } catch (IllegalArgumentException e) { 2236 assertTrue(true); 2237 } 2238 2239 // t index after t1 end 2240 try { 2241 z=7; c=7; t=7; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t; tBy=1; 2242 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2243 fail(); 2244 } catch (IllegalArgumentException e) { 2245 assertTrue(true); 2246 } 2247 2248 // t by < 1 2249 try { 2250 z=7; c=7; t=7; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=0; 2251 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2252 fail(); 2253 } catch (IllegalArgumentException e) { 2254 assertTrue(true); 2255 } 2256 2257 /* TODO  could replace above code with this uber combo test 2258 // comprehensive but probably WAY too much computation to finish in reasonable time 2259 z = 6; c = 5; t = 4; 2260 for (int zStart = 1; zStart < z+2; zStart++) 2261 for (int zEnd = 1; zEnd < z+2; zEnd++) 2262 for (int zInc = 1; zInc < z+2; zInc++) 2263 for (int cStart = 1; cStart < c+2; cStart++) 2264 for (int cEnd = 1; cEnd < c+2; cEnd++) 2265 for (int cInc = 1; cInc < c+2; cInc++) 2266 for (int tStart = 1; tStart < t+2; tStart++) 2267 for (int tEnd = 1; tEnd < t+2; tEnd++) 2268 for (int tInc = 1; tInc < t+2; tInc++) 2269 // if an invalid index of some kind 2270 if ((zStart < 0)  (zStart >= z)  2271 (zEnd < 0)  (zEnd >= z)  // ignored by BF (zEnd < zStart)  2272 (zInc < 1)  2273 (cStart < 0)  (cStart >= c)  2274 (cEnd < 0)  (cEnd >= c)  // ignored by BF (cEnd < cStart)  2275 (cInc < 1)  2276 (tStart < 0)  (tStart >= t)  2277 (tEnd < 0)  (tEnd >= t)  // ignored by BF (tEnd < tStart)  2278 (tInc < 1)) 2279 { 2280 // expect failure 2281 try { 2282 memorySpecifyRangeTester(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2283 System.out.println("memorySpecifyRange() test failed: combo = zct "+z+" "+c+" "+t+ 2284 " z vals "+zFrom+" "+zTo+" "+zBy+ 2285 " c vals "+cFrom+" "+cTo+" "+cBy+ 2286 " t vals "+tFrom+" "+tTo+" "+tBy); 2287 fail("BF did not catch bad indexing code"); 2288 } catch (IllegalArgumentException e) { 2289 assertTrue(true); 2113 for (boolean virtual : BooleanStates) 2114 { 2115 // test partial z: from 2116 z=8; c=3; t=2; zFrom=2; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2117 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2118 2119 // test partial z: to 2120 z=8; c=3; t=2; zFrom=0; zTo=4; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2121 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2122 2123 // test partial z: by 2124 z=8; c=3; t=2; zFrom=0; zTo=z1; zBy=3; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2125 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2126 2127 // test full z 2128 z=8; c=3; t=2; zFrom=2; zTo=7; zBy=3; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2129 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2130 2131 // test partial c: from 2132 z=6; c=14; t=4; zFrom=0; zTo=z1; zBy=1; cFrom=3; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2133 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2134 2135 // test partial c: to 2136 z=6; c=14; t=4; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=6; cBy=1; tFrom=0; tTo=t1; tBy=1; 2137 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2138 2139 // test partial c: by 2140 z=6; c=14; t=4; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=4; tFrom=0; tTo=t1; tBy=1; 2141 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2142 2143 // test full c 2144 z=6; c=14; t=4; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=12; cBy=4; tFrom=0; tTo=t1; tBy=1; 2145 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2146 2147 // test partial t: from 2148 z=3; c=5; t=13; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=4; tTo=t1; tBy=1; 2149 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2150 2151 // test partial t: to 2152 z=3; c=5; t=13; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=8; tBy=1; 2153 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2154 2155 // test partial t: by 2156 z=3; c=5; t=13; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=2; 2157 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2158 2159 // test full t 2160 z=3; c=5; t=13; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=4; tTo=13; tBy=2; 2161 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2162 2163 // test edge case combo with an invalid by 2164 z=2; c=2; t=2; zFrom=0; zTo=0; zBy=2; cFrom=1; cTo=1; cBy=1; tFrom=0; tTo=1; tBy=1; 2165 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2166 2167 // test a combination of zct's 2168 z=5; c=4; t=6; zFrom=1; zTo=4; zBy=2; cFrom=1; cTo=3; cBy=1; tFrom=2; tTo=5; tBy=2; 2169 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2170 2171 // test another combination of zct's 2172 z=7; c=7; t=7; zFrom=3; zTo=6; zBy=4; cFrom=1; cTo=6; cBy=3; tFrom=0; tTo=2; tBy=2; 2173 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2174 2175 // test bad combination of zct's  choosing beyond ends of ranges 2176 2177 // z index before 0 begin 2178 try { 2179 z=7; c=7; t=7; zFrom=1; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2180 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2181 fail(); 2182 } catch (IllegalArgumentException e) { 2183 assertTrue(true); 2184 } 2185 2186 // z index after z1 end 2187 try { 2188 z=7; c=7; t=7; zFrom=0; zTo=z; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2189 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2190 fail(); 2191 } catch (IllegalArgumentException e) { 2192 assertTrue(true); 2193 } 2194 2195 // z by < 1 2196 try { 2197 z=7; c=7; t=7; zFrom=0; zTo=z1; zBy=0; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2198 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2199 fail(); 2200 } catch (IllegalArgumentException e) { 2201 assertTrue(true); 2202 } 2203 2204 // c index before 0 begin 2205 try { 2206 z=7; c=7; t=7; zFrom=0; zTo=z1; zBy=1; cFrom=1; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=1; 2207 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2208 fail(); 2209 } catch (IllegalArgumentException e) { 2210 assertTrue(true); 2211 } 2212 2213 // c index after c1 end 2214 try { 2215 z=7; c=7; t=7; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c; cBy=1; tFrom=0; tTo=t1; tBy=1; 2216 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2217 fail(); 2218 } catch (IllegalArgumentException e) { 2219 assertTrue(true); 2220 } 2221 2222 // c by < 1 2223 try { 2224 z=7; c=7; t=7; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=0; tFrom=0; tTo=t1; tBy=1; 2225 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2226 fail(); 2227 } catch (IllegalArgumentException e) { 2228 assertTrue(true); 2229 } 2230 2231 // t index before 0 begin 2232 try { 2233 z=7; c=7; t=7; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=1; tTo=t1; tBy=1; 2234 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2235 fail(); 2236 } catch (IllegalArgumentException e) { 2237 assertTrue(true); 2238 } 2239 2240 // t index after t1 end 2241 try { 2242 z=7; c=7; t=7; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t; tBy=1; 2243 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2244 fail(); 2245 } catch (IllegalArgumentException e) { 2246 assertTrue(true); 2247 } 2248 2249 // t by < 1 2250 try { 2251 z=7; c=7; t=7; zFrom=0; zTo=z1; zBy=1; cFrom=0; cTo=c1; cBy=1; tFrom=0; tTo=t1; tBy=0; 2252 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2253 fail(); 2254 } catch (IllegalArgumentException e) { 2255 assertTrue(true); 2256 } 2257 2258 /* TODO  could replace above code with this uber combo test 2259 // comprehensive but probably WAY too much computation to finish in reasonable time 2260 z = 6; c = 5; t = 4; 2261 for (int zStart = 1; zStart < z+2; zStart++) 2262 for (int zEnd = 1; zEnd < z+2; zEnd++) 2263 for (int zInc = 1; zInc < z+2; zInc++) 2264 for (int cStart = 1; cStart < c+2; cStart++) 2265 for (int cEnd = 1; cEnd < c+2; cEnd++) 2266 for (int cInc = 1; cInc < c+2; cInc++) 2267 for (int tStart = 1; tStart < t+2; tStart++) 2268 for (int tEnd = 1; tEnd < t+2; tEnd++) 2269 for (int tInc = 1; tInc < t+2; tInc++) 2270 // if an invalid index of some kind 2271 if ((zStart < 0)  (zStart >= z)  2272 (zEnd < 0)  (zEnd >= z)  // ignored by BF (zEnd < zStart)  2273 (zInc < 1)  2274 (cStart < 0)  (cStart >= c)  2275 (cEnd < 0)  (cEnd >= c)  // ignored by BF (cEnd < cStart)  2276 (cInc < 1)  2277 (tStart < 0)  (tStart >= t)  2278 (tEnd < 0)  (tEnd >= t)  // ignored by BF (tEnd < tStart)  2279 (tInc < 1)) 2280 { 2281 // expect failure 2282 try { 2283 memorySpecifyRangeTester(virtual,z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); 2284 System.out.println("memorySpecifyRange() test failed: combo = zct "+z+" "+c+" "+t+ 2285 " z vals "+zFrom+" "+zTo+" "+zBy+ 2286 " c vals "+cFrom+" "+cTo+" "+cBy+ 2287 " t vals "+tFrom+" "+tTo+" "+tBy); 2288 fail("BF did not catch bad indexing code"); 2289 } catch (IllegalArgumentException e) { 2290 assertTrue(true); 2291 } 2290 2292 } 2291 } 2292 else 2293 // expect success 2294 memorySpecifyRangeTester(z,c,t,zStart,zEnd,zInc,cStart,cEnd,cInc,tStart,tEnd,tInc); 2295 */ 2296 2293 else 2294 // expect success 2295 memorySpecifyRangeTester(virtual,z,c,t,zStart,zEnd,zInc,cStart,cEnd,cInc,tStart,tEnd,tInc); 2296 */ 2297 } 2297 2298 } 2298 2299 … … 2300 2301 public void testMemoryCrop() 2301 2302 { 2302 memoryCropTester(203, 255, 55, 20, 3); 2303 memoryCropTester(203, 184, 55, 40, 2); 2304 memoryCropTester(101, 76, 0, 25, 4); 2305 memoryCropTester(100, 122, 0, 15, 3); 2303 for (boolean virtual : BooleanStates) 2304 { 2305 memoryCropTester(virtual, 203, 255, 55, 20, 3); 2306 memoryCropTester(virtual, 203, 184, 55, 40, 2); 2307 memoryCropTester(virtual, 101, 76, 0, 25, 4); 2308 memoryCropTester(virtual, 100, 122, 0, 15, 3); 2309 } 2306 2310 } 2307 2311
Note: See TracChangeset
for help on using the changeset viewer.