--- jsr166/src/test/loops/DequeBash.java 2005/05/02 19:19:38 1.1 +++ jsr166/src/test/loops/DequeBash.java 2005/09/16 11:15:56 1.2 @@ -64,8 +64,10 @@ public class DequeBash { randomOp(deque); // Test iterator occasionally - if ((i & 1023) == 0) + if ((i & 1023) == 0) { testIter(deque); + testDescendingIter(deque); + } // Test serialization and copying if ((i & 4095) == 0) { @@ -97,6 +99,19 @@ public class DequeBash { throw new Exception("Element "+ j + " != " + (next-1)); count++; } + if (count != size()) + throw new Exception("Count " + count + " != " + size()); + } + + static void testDescendingIter(Deque deque) throws Exception { + int next = deque.size() + nextHead; + int count = 0; + for (Iterator it = deque.descendingIterator(); it.hasNext();) { + int j = it.next(); + if (j != next--) + throw new Exception("Element "+ j + " != " + (next-1)); + count++; + } if (count != size()) throw new Exception("Count " + count + " != " + size()); }