/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6420753 6242436 6691185
* @summary Compare NavigableMap implementations for identical behavior
* @run main LockStep
* @author Martin Buchholz
*/
@SuppressWarnings("unchecked")
public class LockStep {
}
// Pass -Dthorough=true for more exhaustive testing
new ConcurrentSkipListMap());
new ConcurrentSkipListMap(reverseOrder()));
new ConcurrentSkipListSet());
new ConcurrentSkipListSet(reverseOrder()));
}
m2);
m2.descendingMap());
fullSubMap(m2));
fullHeadMap(m2));
fullTailMap(m2));
}
s2);
s2.descendingSet());
fullSubSet(s2));
fullHeadSet(s2));
fullTailSet(s2));
}
}
return isAscending(m)
}
return isAscending(m)
}
return isAscending(m)
}
}
return isAscending(s)
}
return isAscending(s)
}
return isAscending(s)
}
}
}
testEmptySet(m.keySet());
testEmptySet(m.entrySet());
testEmptyCollection(m.values());
}
if (maybe(2))
}
}
}
if (s.comparator() == null)
equal2(s, s.descendingSet());
equal2(s, serialClone(s));
if (s.isEmpty()) {
THROWS(NoSuchElementException.class,
} else {
testEmptySet(s.subSet(a, true, a, false));
testEmptySet(s.subSet(z, true, z, false));
testEmptySet(s.headSet(a, false));
testEmptySet(s.tailSet(z, false));
}
s.iterator(),
};
if (maybe(4))
THROWS(IllegalStateException.class,
for (Object e : s) {
} else {
}
prev = e;
}
if (maybe(2))
}
}
if (maybe(2))
}
}
final NavigableSet s2) {
}
}
final NavigableSet s2) {
}
}
// Destined for a Collections.java near you?
int len = 0;
int k = 0;
}
return a;
}
if (m.comparator() == null) {
}
equal2(m, m.descendingMap());
if (maybe(4))
equal2(m, serialClone(m));
if (m.isEmpty()) {
THROWS(NoSuchElementException.class,
} else {
testEmptyMap(m.subMap(a, true, a, false));
testEmptyMap(m.subMap(z, true, z, false));
testEmptyMap(m.headMap(a, false));
testEmptyMap(m.tailMap(z, false));
}
};
};
};
if (maybe(4))
THROWS(IllegalStateException.class,
check(m.containsKey(k));
check(m.containsValue(v));
equal(k, m.ceilingKey(k));
} else {
}
prev = e;
}
if (maybe(2))
}
}
final NavigableMap m2) {
}
NavigableMap m2) {
m2.navigableKeySet());
m2.descendingKeySet());
m2.descendingMap());
m2);
//----------------------------------------------------------------
// submaps
//----------------------------------------------------------------
}
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
}
}
final MapFrobber[] randomAdders = {
if (maybe(4)) {
};
if (maybe(4)) {
}
final SetFrobber[] randomAdders = {
s.descendingSet().add(e);}},
};
}
Integer e;
while (s.contains(e));
return e;
}
Integer k;
while (m.containsKey(k));
return k;
}
return ceiling;
}
return ceiling;
}
check(! m.containsKey(k));
if (maybe(2))
}
if (maybe(2))
if (maybe(2)) {
}
if (maybe(2))
}
}
final MapFrobber[] randomRemovers = {
equal(m.pollFirstEntry(), e);
checkUnusedKey(m, e.getKey());}},
equal(m.pollLastEntry(), e);
checkUnusedKey(m, e.getKey());}},
checkUnusedKey(m, k);}},
checkUnusedKey(m, k);}},
checkUnusedKey(m, k);}},
if (maybe(2))
THROWS(IllegalStateException.class,
}
checkUnusedKey(m, k);}},
if (maybe(2))
THROWS(IllegalStateException.class,
}
checkUnusedKey(m, k);}},
if (maybe(2))
}
checkUnusedKey(m, k);}},
};
}
final SetFrobber[] randomRemovers = {
checkUnusedElt(s, e);}},
checkUnusedElt(s, e);}},
checkUnusedElt(s, e);}},
checkUnusedElt(s, e);}},
checkUnusedElt(s, e);}},
if (maybe(2))
THROWS(IllegalStateException.class,
}
checkUnusedElt(s, e);}},
if (maybe(2))
THROWS(IllegalStateException.class,
}
checkUnusedElt(s, e);}},
if (maybe(2))
THROWS(IllegalStateException.class,
}
checkUnusedElt(s, e);}}
};
}
NavigableMap m2) {
for (int i = 0; i < size; i++) {
for (final NavigableMap m : maps) {
}
}
for (final NavigableMap m : maps) {
THROWS(IllegalArgumentException.class,
.subMap(e,true,e,true);}},
.subMap(e,true,e,true);}},
}
//System.out.printf("%s%n", m1);
for (int i = size; i > 0; i--) {
for (final NavigableMap m : maps) {
}
}
}
NavigableSet s2) {
for (int i = 0; i < size; i++) {
for (final NavigableSet s : sets) {
}
}
for (final NavigableSet s : sets) {
THROWS(IllegalArgumentException.class,
.subSet(e,true,e,true);}},
.subSet(e,true,e,true);}},
}
//System.out.printf("%s%n", s1);
for (int i = size; i > 0; i--) {
for (final NavigableSet s : sets) {
}
}
}
//--------------------- Infrastructure ---------------------------
}
catch (Throwable t) {
else unexpected(t);}}
try {
return baos.toByteArray();
} catch (IOException e) { throw new RuntimeException(e); }}
throws IOException, ClassNotFoundException {
@SuppressWarnings("unchecked")
catch (Exception e) { throw new RuntimeException(e); }}
}