ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/NavigableSetCheck.java
(Generate patch)

Comparing jsr166/src/test/loops/NavigableSetCheck.java (file contents):
Revision 1.10 by jsr166, Thu Dec 18 18:43:22 2014 UTC vs.
Revision 1.13 by jsr166, Mon Aug 10 03:13:33 2015 UTC

# Line 7 | Line 7
7   * @test
8   * @synopsis Times and checks basic set operations
9   */
10 import java.util.*;
10   import java.io.*;
11 + import java.util.*;
12  
13   public class NavigableSetCheck {
14  
# Line 37 | Line 37 | public class NavigableSetCheck {
37              }
38          }
39  
40
40          if (args.length > 1)
41              numTests = Integer.parseInt(args[1]);
42  
# Line 46 | Line 45 | public class NavigableSetCheck {
45  
46          System.out.println("Testing " + setClass.getName() + " trials: " + numTests + " size: " + size);
47  
49
48          absentSize = 8;
49          while (absentSize < size) absentSize <<= 1;
50          absentMask = absentSize - 1;
# Line 59 | Line 57 | public class NavigableSetCheck {
57          for (int i = 0; i < size; ++i)
58              key[i] = new Integer(i * 2 + 1);
59  
62
60          for (int rep = 0; rep < numTests; ++rep) {
61              runTest(newSet(setClass), key);
62          }
63  
64          TestTimer.printStats();
68
65      }
66  
67      static NavigableSet newSet(Class<?> cl) {
# Line 77 | Line 73 | public class NavigableSetCheck {
73          }
74      }
75  
80
76      static void runTest(NavigableSet s, Integer[] key) {
77          shuffle(key);
78          int size = key.length;
# Line 171 | Line 166 | public class NavigableSetCheck {
166          reallyAssert(sum == expect);
167      }
168  
174
169      static void higherTest(NavigableSet s) {
170          int sum = 0;
171          int iters = s.size();
# Line 226 | Line 220 | public class NavigableSetCheck {
220          reallyAssert(sum == iters-1);
221      }
222  
229
223      static void ktest(NavigableSet s, int size, Integer[] key) {
224          timer.start("Contains               ", size);
225          int sum = 0;
# Line 237 | Line 230 | public class NavigableSetCheck {
230          reallyAssert(sum == size);
231      }
232  
240
233      static void ittest1(NavigableSet s, int size) {
234          int sum = 0;
235          timer.start("Iter Key               ", size);
# Line 268 | Line 260 | public class NavigableSetCheck {
260          rittest1(s, size);
261      }
262  
271
263      static void rtest(NavigableSet s, int size) {
264          timer.start("Remove (iterator)      ", size);
265          for (Iterator it = s.iterator(); it.hasNext(); ) {
# Line 278 | Line 269 | public class NavigableSetCheck {
269          timer.finish();
270      }
271  
281
282
272      static void dtest(NavigableSet s, int size, Integer[] key) {
273          timer.start("Add (addAll)           ", size * 2);
274          NavigableSet s2 = null;
# Line 329 | Line 318 | public class NavigableSetCheck {
318          reallyAssert(s2.isEmpty() && s.isEmpty());
319      }
320  
332
333
321      static void test(NavigableSet s, Integer[] key) {
322          int size = key.length;
323  
# Line 391 | Line 378 | public class NavigableSetCheck {
378              startTime = System.currentTimeMillis();
379          }
380  
394
381          String classify() {
382              if (name.startsWith("Contains"))
383                  return "Contains               ";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines