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

Comparing jsr166/src/test/tck/TreeMapTest.java (file contents):
Revision 1.16 by jsr166, Sat Oct 9 19:30:35 2010 UTC vs.
Revision 1.21 by jsr166, Tue May 31 16:16:24 2011 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7   import junit.framework.*;
8   import java.util.*;
9 import java.util.concurrent.*;
10 import java.io.*;
9  
10   public class TreeMapTest extends JSR166TestCase {
11      public static void main(String[] args) {
# Line 119 | Line 117 | public class TreeMapTest extends JSR166T
117          assertEquals(five, map.lastKey());
118      }
119  
122
120      /**
121       * keySet.toArray returns contains all keys
122       */
# Line 413 | Line 410 | public class TreeMapTest extends JSR166T
410          assertNull(e4);
411      }
412  
416
413      /**
414       * lowerKey returns preceding element
415       */
# Line 557 | Line 553 | public class TreeMapTest extends JSR166T
553          TreeMap map = map5();
554          String s = map.toString();
555          for (int i = 1; i <= 5; ++i) {
556 <            assertTrue(s.indexOf(String.valueOf(i)) >= 0);
556 >            assertTrue(s.contains(String.valueOf(i)));
557          }
558      }
559  
# Line 601 | Line 597 | public class TreeMapTest extends JSR166T
597       * A deserialized map equals original
598       */
599      public void testSerialization() throws Exception {
600 <        TreeMap q = map5();
600 >        NavigableMap x = map5();
601 >        NavigableMap y = serialClone(x);
602  
603 <        ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
604 <        ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
605 <        out.writeObject(q);
606 <        out.close();
607 <
611 <        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
612 <        ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
613 <        TreeMap r = (TreeMap)in.readObject();
614 <        assertEquals(q.size(), r.size());
615 <        assertTrue(q.equals(r));
616 <        assertTrue(r.equals(q));
603 >        assertTrue(x != y);
604 >        assertEquals(x.size(), y.size());
605 >        assertEquals(x.toString(), y.toString());
606 >        assertEquals(x, y);
607 >        assertEquals(y, x);
608      }
609  
610      /**
# Line 780 | Line 771 | public class TreeMapTest extends JSR166T
771       * Submaps of submaps subdivide correctly
772       */
773      public void testRecursiveSubMaps() throws Exception {
774 <        int mapSize = 1000;
774 >        int mapSize = expensiveTests ? 1000 : 100;
775          Class cl = TreeMap.class;
776          NavigableMap<Integer, Integer> map = newMap(cl);
777          bs = new BitSet(mapSize);
# Line 961 | Line 952 | public class TreeMapTest extends JSR166T
952       */
953      void check(NavigableMap<Integer, Integer> map,
954                        final int min, final int max, final boolean ascending) {
955 <       class ReferenceSet {
955 >        class ReferenceSet {
956              int lower(int key) {
957                  return ascending ? lowerAscending(key) : higherAscending(key);
958              }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines