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.*; |
11 |
|
|
12 |
|
public class TreeSubMapTest extends JSR166TestCase { |
13 |
|
public static void main(String[] args) { |
14 |
< |
junit.textui.TestRunner.run (suite()); |
14 |
> |
junit.textui.TestRunner.run(suite()); |
15 |
|
} |
16 |
|
public static Test suite() { |
17 |
|
return new TestSuite(TreeSubMapTest.class); |
64 |
|
} |
65 |
|
|
66 |
|
/** |
67 |
< |
* clear removes all pairs |
67 |
> |
* clear removes all pairs |
68 |
|
*/ |
69 |
|
public void testClear() { |
70 |
|
NavigableMap map = map5(); |
74 |
|
|
75 |
|
|
76 |
|
/** |
77 |
< |
* Maps with same contents are equal |
77 |
> |
* Maps with same contents are equal |
78 |
|
*/ |
79 |
|
public void testEquals() { |
80 |
|
NavigableMap map1 = map5(); |
87 |
|
} |
88 |
|
|
89 |
|
/** |
90 |
< |
* containsKey returns true for contained key |
90 |
> |
* containsKey returns true for contained key |
91 |
|
*/ |
92 |
|
public void testContainsKey() { |
93 |
|
NavigableMap map = map5(); |
96 |
|
} |
97 |
|
|
98 |
|
/** |
99 |
< |
* containsValue returns true for held values |
99 |
> |
* containsValue returns true for held values |
100 |
|
*/ |
101 |
|
public void testContainsValue() { |
102 |
|
NavigableMap map = map5(); |
105 |
|
} |
106 |
|
|
107 |
|
/** |
108 |
< |
* get returns the correct element at the given key, |
109 |
< |
* or null if not present |
108 |
> |
* get returns the correct element at the given key, |
109 |
> |
* or null if not present |
110 |
|
*/ |
111 |
|
public void testGet() { |
112 |
|
NavigableMap map = map5(); |
116 |
|
} |
117 |
|
|
118 |
|
/** |
119 |
< |
* isEmpty is true of empty map and false for non-empty |
119 |
> |
* isEmpty is true of empty map and false for non-empty |
120 |
|
*/ |
121 |
|
public void testIsEmpty() { |
122 |
|
NavigableMap empty = map0(); |
126 |
|
} |
127 |
|
|
128 |
|
/** |
129 |
< |
* firstKey returns first key |
129 |
> |
* firstKey returns first key |
130 |
|
*/ |
131 |
|
public void testFirstKey() { |
132 |
|
NavigableMap map = map5(); |
134 |
|
} |
135 |
|
|
136 |
|
/** |
137 |
< |
* lastKey returns last key |
137 |
> |
* lastKey returns last key |
138 |
|
*/ |
139 |
|
public void testLastKey() { |
140 |
|
NavigableMap map = map5(); |
143 |
|
|
144 |
|
|
145 |
|
/** |
146 |
< |
* keySet returns a Set containing all the keys |
146 |
> |
* keySet returns a Set containing all the keys |
147 |
|
*/ |
148 |
|
public void testKeySet() { |
149 |
|
NavigableMap map = map5(); |
157 |
|
} |
158 |
|
|
159 |
|
/** |
160 |
< |
* keySet is ordered |
160 |
> |
* keySet is ordered |
161 |
|
*/ |
162 |
|
public void testKeySetOrder() { |
163 |
|
NavigableMap map = map5(); |
206 |
|
} |
207 |
|
|
208 |
|
/** |
209 |
< |
* putAll adds all key-value pairs from the given map |
209 |
> |
* putAll adds all key-value pairs from the given map |
210 |
|
*/ |
211 |
|
public void testPutAll() { |
212 |
|
NavigableMap empty = map0(); |
221 |
|
} |
222 |
|
|
223 |
|
/** |
224 |
< |
* remove removes the correct key-value pair from the map |
224 |
> |
* remove removes the correct key-value pair from the map |
225 |
|
*/ |
226 |
|
public void testRemove() { |
227 |
|
NavigableMap map = map5(); |
360 |
|
} |
361 |
|
|
362 |
|
/** |
363 |
< |
* size returns the correct values |
363 |
> |
* size returns the correct values |
364 |
|
*/ |
365 |
|
public void testSize() { |
366 |
|
NavigableMap map = map5(); |
584 |
|
} |
585 |
|
|
586 |
|
/** |
587 |
< |
* clear removes all pairs |
587 |
> |
* clear removes all pairs |
588 |
|
*/ |
589 |
|
public void testDescendingClear() { |
590 |
|
NavigableMap map = dmap5(); |
594 |
|
|
595 |
|
|
596 |
|
/** |
597 |
< |
* Maps with same contents are equal |
597 |
> |
* Maps with same contents are equal |
598 |
|
*/ |
599 |
|
public void testDescendingEquals() { |
600 |
|
NavigableMap map1 = dmap5(); |
607 |
|
} |
608 |
|
|
609 |
|
/** |
610 |
< |
* containsKey returns true for contained key |
610 |
> |
* containsKey returns true for contained key |
611 |
|
*/ |
612 |
|
public void testDescendingContainsKey() { |
613 |
|
NavigableMap map = dmap5(); |
616 |
|
} |
617 |
|
|
618 |
|
/** |
619 |
< |
* containsValue returns true for held values |
619 |
> |
* containsValue returns true for held values |
620 |
|
*/ |
621 |
|
public void testDescendingContainsValue() { |
622 |
|
NavigableMap map = dmap5(); |
625 |
|
} |
626 |
|
|
627 |
|
/** |
628 |
< |
* get returns the correct element at the given key, |
629 |
< |
* or null if not present |
628 |
> |
* get returns the correct element at the given key, |
629 |
> |
* or null if not present |
630 |
|
*/ |
631 |
|
public void testDescendingGet() { |
632 |
|
NavigableMap map = dmap5(); |
636 |
|
} |
637 |
|
|
638 |
|
/** |
639 |
< |
* isEmpty is true of empty map and false for non-empty |
639 |
> |
* isEmpty is true of empty map and false for non-empty |
640 |
|
*/ |
641 |
|
public void testDescendingIsEmpty() { |
642 |
|
NavigableMap empty = dmap0(); |
646 |
|
} |
647 |
|
|
648 |
|
/** |
649 |
< |
* firstKey returns first key |
649 |
> |
* firstKey returns first key |
650 |
|
*/ |
651 |
|
public void testDescendingFirstKey() { |
652 |
|
NavigableMap map = dmap5(); |
654 |
|
} |
655 |
|
|
656 |
|
/** |
657 |
< |
* lastKey returns last key |
657 |
> |
* lastKey returns last key |
658 |
|
*/ |
659 |
|
public void testDescendingLastKey() { |
660 |
|
NavigableMap map = dmap5(); |
663 |
|
|
664 |
|
|
665 |
|
/** |
666 |
< |
* keySet returns a Set containing all the keys |
666 |
> |
* keySet returns a Set containing all the keys |
667 |
|
*/ |
668 |
|
public void testDescendingKeySet() { |
669 |
|
NavigableMap map = dmap5(); |
677 |
|
} |
678 |
|
|
679 |
|
/** |
680 |
< |
* keySet is ordered |
680 |
> |
* keySet is ordered |
681 |
|
*/ |
682 |
|
public void testDescendingKeySetOrder() { |
683 |
|
NavigableMap map = dmap5(); |
707 |
|
} |
708 |
|
|
709 |
|
/** |
710 |
< |
* keySet.toArray returns contains all keys |
710 |
> |
* keySet.toArray returns contains all keys |
711 |
|
*/ |
712 |
|
public void testDescendingAscendingKeySetToArray() { |
713 |
|
NavigableMap map = dmap5(); |
720 |
|
} |
721 |
|
|
722 |
|
/** |
723 |
< |
* descendingkeySet.toArray returns contains all keys |
723 |
> |
* descendingkeySet.toArray returns contains all keys |
724 |
|
*/ |
725 |
|
public void testDescendingDescendingKeySetToArray() { |
726 |
|
NavigableMap map = dmap5(); |
733 |
|
} |
734 |
|
|
735 |
|
/** |
736 |
< |
* Values.toArray contains all values |
736 |
> |
* Values.toArray contains all values |
737 |
|
*/ |
738 |
|
public void testDescendingValuesToArray() { |
739 |
|
NavigableMap map = dmap5(); |
769 |
|
} |
770 |
|
|
771 |
|
/** |
772 |
< |
* putAll adds all key-value pairs from the given map |
772 |
> |
* putAll adds all key-value pairs from the given map |
773 |
|
*/ |
774 |
|
public void testDescendingPutAll() { |
775 |
|
NavigableMap empty = dmap0(); |
785 |
|
|
786 |
|
|
787 |
|
/** |
788 |
< |
* remove removes the correct key-value pair from the map |
788 |
> |
* remove removes the correct key-value pair from the map |
789 |
|
*/ |
790 |
|
public void testDescendingRemove() { |
791 |
|
NavigableMap map = dmap5(); |
921 |
|
} |
922 |
|
|
923 |
|
/** |
924 |
< |
* size returns the correct values |
924 |
> |
* size returns the correct values |
925 |
|
*/ |
926 |
|
public void testDescendingSize() { |
927 |
|
NavigableMap map = dmap5(); |