code
stringlengths
11
173k
docstring
stringlengths
2
593k
func_name
stringlengths
2
189
language
stringclasses
1 value
repo
stringclasses
844 values
path
stringlengths
11
294
url
stringlengths
60
339
license
stringclasses
4 values
public void testRemove() { ConcurrentSkipListMap map = map5(); map.remove(five); assertEquals(4, map.size()); assertFalse(map.containsKey(five)); }
remove removes the correct key-value pair from the map
ConcurrentSkipListMapTest::testRemove
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testRemove2() { ConcurrentSkipListMap map = map5(); assertTrue(map.containsKey(five)); assertEquals("E", map.get(five)); map.remove(five, "E"); assertEquals(4, map.size()); assertFalse(map.containsKey(five)); map.remove(four, "A"); assertEquals(4, map.size()); assertTrue(map.containsKey(four)); }
remove(key,value) removes only if pair present
ConcurrentSkipListMapTest::testRemove2
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testLowerEntry() { ConcurrentSkipListMap map = map5(); Map.Entry e1 = map.lowerEntry(three); assertEquals(two, e1.getKey()); Map.Entry e2 = map.lowerEntry(six); assertEquals(five, e2.getKey()); Map.Entry e3 = map.lowerEntry(one); assertNull(e3); Map.Entry e4 = map.lowerEntry(zero); assertNull(e4); }
lowerEntry returns preceding entry.
ConcurrentSkipListMapTest::testLowerEntry
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testHigherEntry() { ConcurrentSkipListMap map = map5(); Map.Entry e1 = map.higherEntry(three); assertEquals(four, e1.getKey()); Map.Entry e2 = map.higherEntry(zero); assertEquals(one, e2.getKey()); Map.Entry e3 = map.higherEntry(five); assertNull(e3); Map.Entry e4 = map.higherEntry(six); assertNull(e4); }
higherEntry returns next entry.
ConcurrentSkipListMapTest::testHigherEntry
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testFloorEntry() { ConcurrentSkipListMap map = map5(); Map.Entry e1 = map.floorEntry(three); assertEquals(three, e1.getKey()); Map.Entry e2 = map.floorEntry(six); assertEquals(five, e2.getKey()); Map.Entry e3 = map.floorEntry(one); assertEquals(one, e3.getKey()); Map.Entry e4 = map.floorEntry(zero); assertNull(e4); }
floorEntry returns preceding entry.
ConcurrentSkipListMapTest::testFloorEntry
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testCeilingEntry() { ConcurrentSkipListMap map = map5(); Map.Entry e1 = map.ceilingEntry(three); assertEquals(three, e1.getKey()); Map.Entry e2 = map.ceilingEntry(zero); assertEquals(one, e2.getKey()); Map.Entry e3 = map.ceilingEntry(five); assertEquals(five, e3.getKey()); Map.Entry e4 = map.ceilingEntry(six); assertNull(e4); }
ceilingEntry returns next entry.
ConcurrentSkipListMapTest::testCeilingEntry
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testEntryImmutability() { ConcurrentSkipListMap map = map5(); Map.Entry e = map.lowerEntry(three); assertEquals(two, e.getKey()); try { e.setValue("X"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.higherEntry(zero); assertEquals(one, e.getKey()); try { e.setValue("X"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.floorEntry(one); assertEquals(one, e.getKey()); try { e.setValue("X"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.ceilingEntry(five); assertEquals(five, e.getKey()); try { e.setValue("X"); shouldThrow(); } catch (UnsupportedOperationException success) {} }
lowerEntry, higherEntry, ceilingEntry, and floorEntry return immutable entries
ConcurrentSkipListMapTest::testEntryImmutability
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testLowerKey() { ConcurrentSkipListMap q = map5(); Object e1 = q.lowerKey(three); assertEquals(two, e1); Object e2 = q.lowerKey(six); assertEquals(five, e2); Object e3 = q.lowerKey(one); assertNull(e3); Object e4 = q.lowerKey(zero); assertNull(e4); }
lowerKey returns preceding element
ConcurrentSkipListMapTest::testLowerKey
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testHigherKey() { ConcurrentSkipListMap q = map5(); Object e1 = q.higherKey(three); assertEquals(four, e1); Object e2 = q.higherKey(zero); assertEquals(one, e2); Object e3 = q.higherKey(five); assertNull(e3); Object e4 = q.higherKey(six); assertNull(e4); }
higherKey returns next element
ConcurrentSkipListMapTest::testHigherKey
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testFloorKey() { ConcurrentSkipListMap q = map5(); Object e1 = q.floorKey(three); assertEquals(three, e1); Object e2 = q.floorKey(six); assertEquals(five, e2); Object e3 = q.floorKey(one); assertEquals(one, e3); Object e4 = q.floorKey(zero); assertNull(e4); }
floorKey returns preceding element
ConcurrentSkipListMapTest::testFloorKey
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testCeilingKey() { ConcurrentSkipListMap q = map5(); Object e1 = q.ceilingKey(three); assertEquals(three, e1); Object e2 = q.ceilingKey(zero); assertEquals(one, e2); Object e3 = q.ceilingKey(five); assertEquals(five, e3); Object e4 = q.ceilingKey(six); assertNull(e4); }
ceilingKey returns next element
ConcurrentSkipListMapTest::testCeilingKey
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testPollFirstEntry() { ConcurrentSkipListMap map = map5(); Map.Entry e = map.pollFirstEntry(); assertEquals(one, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(two, e.getKey()); map.put(one, "A"); e = map.pollFirstEntry(); assertEquals(one, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(three, e.getKey()); map.remove(four); e = map.pollFirstEntry(); assertEquals(five, e.getKey()); try { e.setValue("A"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.pollFirstEntry(); assertNull(e); }
pollFirstEntry returns entries in order
ConcurrentSkipListMapTest::testPollFirstEntry
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testPollLastEntry() { ConcurrentSkipListMap map = map5(); Map.Entry e = map.pollLastEntry(); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(four, e.getKey()); map.put(five, "E"); e = map.pollLastEntry(); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(three, e.getKey()); map.remove(two); e = map.pollLastEntry(); assertEquals(one, e.getKey()); try { e.setValue("E"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.pollLastEntry(); assertNull(e); }
pollLastEntry returns entries in order
ConcurrentSkipListMapTest::testPollLastEntry
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testSize() { ConcurrentSkipListMap map = map5(); ConcurrentSkipListMap empty = new ConcurrentSkipListMap(); assertEquals(0, empty.size()); assertEquals(5, map.size()); }
size returns the correct values
ConcurrentSkipListMapTest::testSize
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testToString() { ConcurrentSkipListMap map = map5(); String s = map.toString(); for (int i = 1; i <= 5; ++i) { assertTrue(s.contains(String.valueOf(i))); } }
toString contains toString of elements
ConcurrentSkipListMapTest::testToString
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testGet_NullPointerException() { ConcurrentSkipListMap c = map5(); try { c.get(null); shouldThrow(); } catch (NullPointerException success) {} }
get(null) of nonempty map throws NPE
ConcurrentSkipListMapTest::testGet_NullPointerException
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testContainsKey_NullPointerException() { ConcurrentSkipListMap c = map5(); try { c.containsKey(null); shouldThrow(); } catch (NullPointerException success) {} }
containsKey(null) of nonempty map throws NPE
ConcurrentSkipListMapTest::testContainsKey_NullPointerException
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testContainsValue_NullPointerException() { ConcurrentSkipListMap c = new ConcurrentSkipListMap(); try { c.containsValue(null); shouldThrow(); } catch (NullPointerException success) {} }
containsValue(null) throws NPE
ConcurrentSkipListMapTest::testContainsValue_NullPointerException
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testPut1_NullPointerException() { ConcurrentSkipListMap c = map5(); try { c.put(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} }
put(null,x) throws NPE
ConcurrentSkipListMapTest::testPut1_NullPointerException
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testPutIfAbsent1_NullPointerException() { ConcurrentSkipListMap c = map5(); try { c.putIfAbsent(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} }
putIfAbsent(null, x) throws NPE
ConcurrentSkipListMapTest::testPutIfAbsent1_NullPointerException
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testReplace_NullPointerException() { ConcurrentSkipListMap c = map5(); try { c.replace(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} }
replace(null, x) throws NPE
ConcurrentSkipListMapTest::testReplace_NullPointerException
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testReplaceValue_NullPointerException() { ConcurrentSkipListMap c = map5(); try { c.replace(null, one, "whatever"); shouldThrow(); } catch (NullPointerException success) {} }
replace(null, x, y) throws NPE
ConcurrentSkipListMapTest::testReplaceValue_NullPointerException
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testRemove1_NullPointerException() { ConcurrentSkipListMap c = new ConcurrentSkipListMap(); c.put("sadsdf", "asdads"); try { c.remove(null); shouldThrow(); } catch (NullPointerException success) {} }
remove(null) throws NPE
ConcurrentSkipListMapTest::testRemove1_NullPointerException
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testRemove2_NullPointerException() { ConcurrentSkipListMap c = new ConcurrentSkipListMap(); c.put("sadsdf", "asdads"); try { c.remove(null, "whatever"); shouldThrow(); } catch (NullPointerException success) {} }
remove(null, x) throws NPE
ConcurrentSkipListMapTest::testRemove2_NullPointerException
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testRemove3() { ConcurrentSkipListMap c = new ConcurrentSkipListMap(); c.put("sadsdf", "asdads"); assertFalse(c.remove("sadsdf", null)); }
remove(x, null) returns false
ConcurrentSkipListMapTest::testRemove3
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testSerialization() throws Exception { NavigableMap x = map5(); NavigableMap y = serialClone(x); assertNotSame(x, y); assertEquals(x.size(), y.size()); assertEquals(x.toString(), y.toString()); assertEquals(x, y); assertEquals(y, x); }
A deserialized map equals original
ConcurrentSkipListMapTest::testSerialization
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testSubMapContents() { ConcurrentSkipListMap map = map5(); NavigableMap sm = map.subMap(two, true, four, false); assertEquals(two, sm.firstKey()); assertEquals(three, sm.lastKey()); assertEquals(2, sm.size()); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); Iterator r = sm.descendingKeySet().iterator(); k = (Integer)(r.next()); assertEquals(three, k); k = (Integer)(r.next()); assertEquals(two, k); assertFalse(r.hasNext()); Iterator j = sm.keySet().iterator(); j.next(); j.remove(); assertFalse(map.containsKey(two)); assertEquals(4, map.size()); assertEquals(1, sm.size()); assertEquals(three, sm.firstKey()); assertEquals(three, sm.lastKey()); assertEquals("C", sm.remove(three)); assertTrue(sm.isEmpty()); assertEquals(3, map.size()); }
subMap returns map with keys in requested range
ConcurrentSkipListMapTest::testSubMapContents
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testHeadMapContents() { ConcurrentSkipListMap map = map5(); NavigableMap sm = map.headMap(four, false); assertTrue(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(one, k); k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); sm.clear(); assertTrue(sm.isEmpty()); assertEquals(2, map.size()); assertEquals(four, map.firstKey()); }
headMap returns map with keys in requested range
ConcurrentSkipListMapTest::testHeadMapContents
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testTailMapContents() { ConcurrentSkipListMap map = map5(); NavigableMap sm = map.tailMap(two, true); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertTrue(sm.containsKey(four)); assertTrue(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); k = (Integer)(i.next()); assertEquals(four, k); k = (Integer)(i.next()); assertEquals(five, k); assertFalse(i.hasNext()); Iterator r = sm.descendingKeySet().iterator(); k = (Integer)(r.next()); assertEquals(five, k); k = (Integer)(r.next()); assertEquals(four, k); k = (Integer)(r.next()); assertEquals(three, k); k = (Integer)(r.next()); assertEquals(two, k); assertFalse(r.hasNext()); Iterator ei = sm.entrySet().iterator(); Map.Entry e; e = (Map.Entry)(ei.next()); assertEquals(two, e.getKey()); assertEquals("B", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(three, e.getKey()); assertEquals("C", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(four, e.getKey()); assertEquals("D", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); assertFalse(i.hasNext()); NavigableMap ssm = sm.tailMap(four, true); assertEquals(four, ssm.firstKey()); assertEquals(five, ssm.lastKey()); assertEquals("D", ssm.remove(four)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, map.size()); }
tailMap returns map with keys in requested range
ConcurrentSkipListMapTest::testTailMapContents
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testRecursiveSubMaps() throws Exception { int mapSize = expensiveTests ? 1000 : 100; Class cl = ConcurrentSkipListMap.class; NavigableMap<Integer, Integer> map = newMap(cl); bs = new BitSet(mapSize); populate(map, mapSize); check(map, 0, mapSize - 1, true); check(map.descendingMap(), 0, mapSize - 1, false); mutateMap(map, 0, mapSize - 1); check(map, 0, mapSize - 1, true); check(map.descendingMap(), 0, mapSize - 1, false); bashSubMap(map.subMap(0, true, mapSize, false), 0, mapSize - 1, true); }
Submaps of submaps subdivide correctly
ConcurrentSkipListMapTest::testRecursiveSubMaps
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListMapTest.java
Apache-2.0
public void testCommonPoolParallelism() { assertEquals(ForkJoinPool.getCommonPoolParallelism(), ForkJoinPool.commonPool().getParallelism()); }
Common pool exists and has expected parallelism.
ForkJoinPool8Test::testCommonPoolParallelism
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testCommonPoolShutDown() { assertFalse(ForkJoinPool.commonPool().isShutdown()); assertFalse(ForkJoinPool.commonPool().isTerminating()); assertFalse(ForkJoinPool.commonPool().isTerminated()); ForkJoinPool.commonPool().shutdown(); assertFalse(ForkJoinPool.commonPool().isShutdown()); assertFalse(ForkJoinPool.commonPool().isTerminating()); assertFalse(ForkJoinPool.commonPool().isTerminated()); ForkJoinPool.commonPool().shutdownNow(); assertFalse(ForkJoinPool.commonPool().isShutdown()); assertFalse(ForkJoinPool.commonPool().isTerminating()); assertFalse(ForkJoinPool.commonPool().isTerminated()); }
Common pool cannot be shut down
ForkJoinPool8Test::testCommonPoolShutDown
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testInvoke() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); assertNull(f.invoke()); assertEquals(21, f.result); checkCompletedNormally(f); }}; checkInvoke(a); }
invoke returns when task completes normally. isCompletedAbnormally and isCancelled return false for normally completed tasks. getRawResult of a RecursiveAction returns null;
FailingFibAction::testInvoke
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testQuietlyInvoke() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); f.quietlyInvoke(); assertEquals(21, f.result); checkCompletedNormally(f); }}; checkInvoke(a); }
quietlyInvoke task returns when task completes normally. isCompletedAbnormally and isCancelled return false for normally completed tasks
FailingFibAction::testQuietlyInvoke
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testForkJoin() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); assertSame(f, f.fork()); assertNull(f.join()); assertEquals(21, f.result); checkCompletedNormally(f); }}; checkInvoke(a); }
join of a forked task returns when task completes
FailingFibAction::testForkJoin
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testJoinIgnoresInterrupts() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); final Thread myself = Thread.currentThread(); // test join() assertSame(f, f.fork()); myself.interrupt(); assertTrue(myself.isInterrupted()); assertNull(f.join()); Thread.interrupted(); assertEquals(21, f.result); checkCompletedNormally(f); f = new FibAction(8); f.cancel(true); assertSame(f, f.fork()); myself.interrupt(); assertTrue(myself.isInterrupted()); try { f.join(); shouldThrow(); } catch (CancellationException success) { Thread.interrupted(); checkCancelled(f); } f = new FibAction(8); f.completeExceptionally(new FJException()); assertSame(f, f.fork()); myself.interrupt(); assertTrue(myself.isInterrupted()); try { f.join(); shouldThrow(); } catch (FJException success) { Thread.interrupted(); checkCompletedAbnormally(f, success); } // test quietlyJoin() f = new FibAction(8); assertSame(f, f.fork()); myself.interrupt(); assertTrue(myself.isInterrupted()); f.quietlyJoin(); Thread.interrupted(); assertEquals(21, f.result); checkCompletedNormally(f); f = new FibAction(8); f.cancel(true); assertSame(f, f.fork()); myself.interrupt(); assertTrue(myself.isInterrupted()); f.quietlyJoin(); Thread.interrupted(); checkCancelled(f); f = new FibAction(8); f.completeExceptionally(new FJException()); assertSame(f, f.fork()); myself.interrupt(); assertTrue(myself.isInterrupted()); f.quietlyJoin(); Thread.interrupted(); checkCompletedAbnormally(f, f.getException()); }}; checkInvoke(a); a.reinitialize(); checkInvoke(a); }
join/quietlyJoin of a forked task succeeds in the presence of interrupts
FailingFibAction::testJoinIgnoresInterrupts
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testForkGet() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() throws Exception { FibAction f = new FibAction(8); assertSame(f, f.fork()); assertNull(f.get()); assertEquals(21, f.result); checkCompletedNormally(f); }}; checkInvoke(a); }
get of a forked task returns when task completes
FailingFibAction::testForkGet
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testForkTimedGet() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() throws Exception { FibAction f = new FibAction(8); assertSame(f, f.fork()); assertNull(f.get(5L, SECONDS)); assertEquals(21, f.result); checkCompletedNormally(f); }}; checkInvoke(a); }
timed get of a forked task returns when task completes
FailingFibAction::testForkTimedGet
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testForkTimedGetNPE() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() throws Exception { FibAction f = new FibAction(8); assertSame(f, f.fork()); try { f.get(5L, null); shouldThrow(); } catch (NullPointerException success) {} }}; checkInvoke(a); }
timed get with null time unit throws NPE
FailingFibAction::testForkTimedGetNPE
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testForkQuietlyJoin() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); assertSame(f, f.fork()); f.quietlyJoin(); assertEquals(21, f.result); checkCompletedNormally(f); }}; checkInvoke(a); }
quietlyJoin of a forked task returns when task completes
FailingFibAction::testForkQuietlyJoin
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalInvoke() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FailingFibAction f = new FailingFibAction(8); try { f.invoke(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; checkInvoke(a); }
invoke task throws exception when task completes abnormally
FailingFibAction::testAbnormalInvoke
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalQuietlyInvoke() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FailingFibAction f = new FailingFibAction(8); f.quietlyInvoke(); assertTrue(f.getException() instanceof FJException); checkCompletedAbnormally(f, f.getException()); }}; checkInvoke(a); }
quietlyInvoke task returns when task completes abnormally
FailingFibAction::testAbnormalQuietlyInvoke
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalForkJoin() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FailingFibAction f = new FailingFibAction(8); assertSame(f, f.fork()); try { f.join(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; checkInvoke(a); }
join of a forked task throws exception when task completes abnormally
FailingFibAction::testAbnormalForkJoin
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalForkGet() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() throws Exception { FailingFibAction f = new FailingFibAction(8); assertSame(f, f.fork()); try { f.get(); shouldThrow(); } catch (ExecutionException success) { Throwable cause = success.getCause(); assertTrue(cause instanceof FJException); checkCompletedAbnormally(f, cause); } }}; checkInvoke(a); }
get of a forked task throws exception when task completes abnormally
FailingFibAction::testAbnormalForkGet
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalForkTimedGet() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() throws Exception { FailingFibAction f = new FailingFibAction(8); assertSame(f, f.fork()); try { f.get(5L, SECONDS); shouldThrow(); } catch (ExecutionException success) { Throwable cause = success.getCause(); assertTrue(cause instanceof FJException); checkCompletedAbnormally(f, cause); } }}; checkInvoke(a); }
timed get of a forked task throws exception when task completes abnormally
FailingFibAction::testAbnormalForkTimedGet
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalForkQuietlyJoin() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FailingFibAction f = new FailingFibAction(8); assertSame(f, f.fork()); f.quietlyJoin(); assertTrue(f.getException() instanceof FJException); checkCompletedAbnormally(f, f.getException()); }}; checkInvoke(a); }
quietlyJoin of a forked task returns when task completes abnormally
FailingFibAction::testAbnormalForkQuietlyJoin
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testCancelledInvoke() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); assertTrue(f.cancel(true)); try { f.invoke(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; checkInvoke(a); }
invoke task throws exception when task cancelled
FailingFibAction::testCancelledInvoke
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testCancelledForkJoin() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { f.join(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; checkInvoke(a); }
join of a forked task throws exception when task cancelled
FailingFibAction::testCancelledForkJoin
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testCancelledForkGet() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() throws Exception { FibAction f = new FibAction(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { f.get(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; checkInvoke(a); }
get of a forked task throws exception when task cancelled
FailingFibAction::testCancelledForkGet
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testCancelledForkTimedGet() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() throws Exception { FibAction f = new FibAction(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { f.get(5L, SECONDS); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; checkInvoke(a); }
timed get of a forked task throws exception when task cancelled
FailingFibAction::testCancelledForkTimedGet
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testCancelledForkQuietlyJoin() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); f.quietlyJoin(); checkCancelled(f); }}; checkInvoke(a); }
quietlyJoin of a forked task returns when task cancelled
FailingFibAction::testCancelledForkQuietlyJoin
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testInForkJoinPool2() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { assertFalse(inForkJoinPool()); }}; assertNull(a.invoke()); }
inForkJoinPool of non-FJ task returns false
FailingFibAction::testInForkJoinPool2
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testReinitialize() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); checkNotDone(f); for (int i = 0; i < 3; i++) { assertNull(f.invoke()); assertEquals(21, f.result); checkCompletedNormally(f); f.reinitialize(); checkNotDone(f); } }}; checkInvoke(a); }
A reinitialized normally completed task may be re-invoked
FailingFibAction::testReinitialize
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testReinitializeAbnormal() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FailingFibAction f = new FailingFibAction(8); checkNotDone(f); for (int i = 0; i < 3; i++) { try { f.invoke(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } f.reinitialize(); checkNotDone(f); } }}; checkInvoke(a); }
A reinitialized abnormally completed task may be re-invoked
FailingFibAction::testReinitializeAbnormal
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testCompleteExceptionally() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); f.completeExceptionally(new FJException()); try { f.invoke(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; checkInvoke(a); }
invoke task throws exception after invoking completeExceptionally
FailingFibAction::testCompleteExceptionally
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testComplete() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); f.complete(null); assertNull(f.invoke()); assertEquals(0, f.result); checkCompletedNormally(f); }}; checkInvoke(a); }
invoke task suppresses execution invoking complete
FailingFibAction::testComplete
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testInvokeAll2() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); FibAction g = new FibAction(9); invokeAll(f, g); checkCompletedNormally(f); assertEquals(21, f.result); checkCompletedNormally(g); assertEquals(34, g.result); }}; checkInvoke(a); }
invokeAll(t1, t2) invokes all task arguments
FailingFibAction::testInvokeAll2
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testInvokeAll1() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); invokeAll(f); checkCompletedNormally(f); assertEquals(21, f.result); }}; checkInvoke(a); }
invokeAll(tasks) with 1 argument invokes task
FailingFibAction::testInvokeAll1
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testInvokeAll3() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); FibAction g = new FibAction(9); FibAction h = new FibAction(7); invokeAll(f, g, h); assertTrue(f.isDone()); assertTrue(g.isDone()); assertTrue(h.isDone()); checkCompletedNormally(f); assertEquals(21, f.result); checkCompletedNormally(g); assertEquals(34, g.result); checkCompletedNormally(g); assertEquals(13, h.result); }}; checkInvoke(a); }
invokeAll(tasks) with > 2 argument invokes tasks
FailingFibAction::testInvokeAll3
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testInvokeAllCollection() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); FibAction g = new FibAction(9); FibAction h = new FibAction(7); HashSet set = new HashSet(); set.add(f); set.add(g); set.add(h); invokeAll(set); assertTrue(f.isDone()); assertTrue(g.isDone()); assertTrue(h.isDone()); checkCompletedNormally(f); assertEquals(21, f.result); checkCompletedNormally(g); assertEquals(34, g.result); checkCompletedNormally(g); assertEquals(13, h.result); }}; checkInvoke(a); }
invokeAll(collection) invokes all tasks in the collection
FailingFibAction::testInvokeAllCollection
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testInvokeAllNPE() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); FibAction g = new FibAction(9); FibAction h = null; try { invokeAll(f, g, h); shouldThrow(); } catch (NullPointerException success) {} }}; checkInvoke(a); }
invokeAll(tasks) with any null task throws NPE
FailingFibAction::testInvokeAllNPE
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalInvokeAll2() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); FailingFibAction g = new FailingFibAction(9); try { invokeAll(f, g); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } }}; checkInvoke(a); }
invokeAll(t1, t2) throw exception if any task does
FailingFibAction::testAbnormalInvokeAll2
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalInvokeAll1() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FailingFibAction g = new FailingFibAction(9); try { invokeAll(g); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } }}; checkInvoke(a); }
invokeAll(tasks) with 1 argument throws exception if task does
FailingFibAction::testAbnormalInvokeAll1
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalInvokeAll3() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); FailingFibAction g = new FailingFibAction(9); FibAction h = new FibAction(7); try { invokeAll(f, g, h); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } }}; checkInvoke(a); }
invokeAll(tasks) with > 2 argument throws exception if any task does
FailingFibAction::testAbnormalInvokeAll3
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalInvokeAllCollection() { RecursiveAction a = new CheckedRecursiveAction() { protected void realCompute() { FailingFibAction f = new FailingFibAction(8); FibAction g = new FibAction(9); FibAction h = new FibAction(7); HashSet set = new HashSet(); set.add(f); set.add(g); set.add(h); try { invokeAll(set); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; checkInvoke(a); }
invokeAll(collection) throws exception if any task does
FailingFibAction::testAbnormalInvokeAllCollection
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testInvokeCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { CCF f = new LCCF(null, 8); assertNull(f.invoke()); assertEquals(21, f.number); checkCompletedNormally(f); }}; checkInvoke(a); }
invoke returns when task completes normally. isCompletedAbnormally and isCancelled return false for normally completed tasks; getRawResult returns null.
RFCCF::testInvokeCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testQuietlyInvokeCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { CCF f = new LCCF(null, 8); f.quietlyInvoke(); assertEquals(21, f.number); checkCompletedNormally(f); }}; checkInvoke(a); }
quietlyInvoke task returns when task completes normally. isCompletedAbnormally and isCancelled return false for normally completed tasks
RFCCF::testQuietlyInvokeCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testForkJoinCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { CCF f = new LCCF(null, 8); assertSame(f, f.fork()); assertNull(f.join()); assertEquals(21, f.number); checkCompletedNormally(f); }}; checkInvoke(a); }
join of a forked task returns when task completes
RFCCF::testForkJoinCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testForkGetCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() throws Exception { CCF f = new LCCF(null, 8); assertSame(f, f.fork()); assertNull(f.get()); assertEquals(21, f.number); checkCompletedNormally(f); }}; checkInvoke(a); }
get of a forked task returns when task completes
RFCCF::testForkGetCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testForkTimedGetCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() throws Exception { CCF f = new LCCF(null, 8); assertSame(f, f.fork()); assertNull(f.get(LONG_DELAY_MS, MILLISECONDS)); assertEquals(21, f.number); checkCompletedNormally(f); }}; checkInvoke(a); }
timed get of a forked task returns when task completes
RFCCF::testForkTimedGetCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testForkTimedGetNPECC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() throws Exception { CCF f = new LCCF(null, 8); assertSame(f, f.fork()); try { f.get(5L, null); shouldThrow(); } catch (NullPointerException success) {} }}; checkInvoke(a); }
timed get with null time unit throws NPE
RFCCF::testForkTimedGetNPECC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testForkQuietlyJoinCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { CCF f = new LCCF(null, 8); assertSame(f, f.fork()); f.quietlyJoin(); assertEquals(21, f.number); checkCompletedNormally(f); }}; checkInvoke(a); }
quietlyJoin of a forked task returns when task completes
RFCCF::testForkQuietlyJoinCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalInvokeCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { FailingCCF f = new LFCCF(null, 8); try { f.invoke(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; checkInvoke(a); }
invoke task throws exception when task completes abnormally
RFCCF::testAbnormalInvokeCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalQuietlyInvokeCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { FailingCCF f = new LFCCF(null, 8); f.quietlyInvoke(); assertTrue(f.getException() instanceof FJException); checkCompletedAbnormally(f, f.getException()); }}; checkInvoke(a); }
quietlyInvoke task returns when task completes abnormally
RFCCF::testAbnormalQuietlyInvokeCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalForkJoinCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { FailingCCF f = new LFCCF(null, 8); assertSame(f, f.fork()); try { f.join(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; checkInvoke(a); }
join of a forked task throws exception when task completes abnormally
RFCCF::testAbnormalForkJoinCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalForkGetCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() throws Exception { FailingCCF f = new LFCCF(null, 8); assertSame(f, f.fork()); try { f.get(); shouldThrow(); } catch (ExecutionException success) { Throwable cause = success.getCause(); assertTrue(cause instanceof FJException); checkCompletedAbnormally(f, cause); } }}; checkInvoke(a); }
get of a forked task throws exception when task completes abnormally
RFCCF::testAbnormalForkGetCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalForkTimedGetCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() throws Exception { FailingCCF f = new LFCCF(null, 8); assertSame(f, f.fork()); try { f.get(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (ExecutionException success) { Throwable cause = success.getCause(); assertTrue(cause instanceof FJException); checkCompletedAbnormally(f, cause); } }}; checkInvoke(a); }
timed get of a forked task throws exception when task completes abnormally
RFCCF::testAbnormalForkTimedGetCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalForkQuietlyJoinCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { FailingCCF f = new LFCCF(null, 8); assertSame(f, f.fork()); f.quietlyJoin(); assertTrue(f.getException() instanceof FJException); checkCompletedAbnormally(f, f.getException()); }}; checkInvoke(a); }
quietlyJoin of a forked task returns when task completes abnormally
RFCCF::testAbnormalForkQuietlyJoinCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testCancelledInvokeCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { CCF f = new LCCF(null, 8); assertTrue(f.cancel(true)); try { f.invoke(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; checkInvoke(a); }
invoke task throws exception when task cancelled
RFCCF::testCancelledInvokeCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testCancelledForkJoinCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { CCF f = new LCCF(null, 8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { f.join(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; checkInvoke(a); }
join of a forked task throws exception when task cancelled
RFCCF::testCancelledForkJoinCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testCancelledForkGetCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() throws Exception { CCF f = new LCCF(null, 8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { f.get(); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; checkInvoke(a); }
get of a forked task throws exception when task cancelled
RFCCF::testCancelledForkGetCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testCancelledForkTimedGetCC() throws Exception { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() throws Exception { CCF f = new LCCF(null, 8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); try { f.get(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (CancellationException success) { checkCancelled(f); } }}; checkInvoke(a); }
timed get of a forked task throws exception when task cancelled
RFCCF::testCancelledForkTimedGetCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testCancelledForkQuietlyJoinCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { CCF f = new LCCF(null, 8); assertTrue(f.cancel(true)); assertSame(f, f.fork()); f.quietlyJoin(); checkCancelled(f); }}; checkInvoke(a); }
quietlyJoin of a forked task returns when task cancelled
RFCCF::testCancelledForkQuietlyJoinCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testGetPool2CC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { assertNull(getPool()); }}; assertNull(a.invoke()); }
getPool of non-FJ task returns null
RFCCF::testGetPool2CC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testInForkJoinPool2CC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { assertFalse(inForkJoinPool()); }}; assertNull(a.invoke()); }
inForkJoinPool of non-FJ task returns false
RFCCF::testInForkJoinPool2CC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testSetRawResultCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { setRawResult(null); assertNull(getRawResult()); }}; assertNull(a.invoke()); }
setRawResult(null) succeeds
RFCCF::testSetRawResultCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testCompleteExceptionally2CC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { CCF f = new LCCF(null, 8); f.completeExceptionally(new FJException()); try { f.invoke(); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; checkInvoke(a); }
invoke task throws exception after invoking completeExceptionally
RFCCF::testCompleteExceptionally2CC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testInvokeAll2CC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { CCF f = new LCCF(null, 8); CCF g = new LCCF(null, 9); invokeAll(f, g); assertEquals(21, f.number); assertEquals(34, g.number); checkCompletedNormally(f); checkCompletedNormally(g); }}; checkInvoke(a); }
invokeAll(t1, t2) invokes all task arguments
RFCCF::testInvokeAll2CC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testInvokeAll1CC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { CCF f = new LCCF(null, 8); invokeAll(f); checkCompletedNormally(f); assertEquals(21, f.number); }}; checkInvoke(a); }
invokeAll(tasks) with 1 argument invokes task
RFCCF::testInvokeAll1CC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testInvokeAll3CC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { CCF f = new LCCF(null, 8); CCF g = new LCCF(null, 9); CCF h = new LCCF(null, 7); invokeAll(f, g, h); assertEquals(21, f.number); assertEquals(34, g.number); assertEquals(13, h.number); checkCompletedNormally(f); checkCompletedNormally(g); checkCompletedNormally(h); }}; checkInvoke(a); }
invokeAll(tasks) with > 2 argument invokes tasks
RFCCF::testInvokeAll3CC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testInvokeAllCollectionCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { CCF f = new LCCF(null, 8); CCF g = new LCCF(null, 9); CCF h = new LCCF(null, 7); HashSet set = new HashSet(); set.add(f); set.add(g); set.add(h); invokeAll(set); assertEquals(21, f.number); assertEquals(34, g.number); assertEquals(13, h.number); checkCompletedNormally(f); checkCompletedNormally(g); checkCompletedNormally(h); }}; checkInvoke(a); }
invokeAll(collection) invokes all tasks in the collection
RFCCF::testInvokeAllCollectionCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testInvokeAllNPECC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { CCF f = new LCCF(null, 8); CCF g = new LCCF(null, 9); CCF h = null; try { invokeAll(f, g, h); shouldThrow(); } catch (NullPointerException success) {} }}; checkInvoke(a); }
invokeAll(tasks) with any null task throws NPE
RFCCF::testInvokeAllNPECC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalInvokeAll2CC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { CCF f = new LCCF(null, 8); FailingCCF g = new LFCCF(null, 9); try { invokeAll(f, g); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } }}; checkInvoke(a); }
invokeAll(t1, t2) throw exception if any task does
RFCCF::testAbnormalInvokeAll2CC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalInvokeAll1CC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { FailingCCF g = new LFCCF(null, 9); try { invokeAll(g); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } }}; checkInvoke(a); }
invokeAll(tasks) with 1 argument throws exception if task does
RFCCF::testAbnormalInvokeAll1CC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalInvokeAll3CC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { CCF f = new LCCF(null, 8); FailingCCF g = new LFCCF(null, 9); CCF h = new LCCF(null, 7); try { invokeAll(f, g, h); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(g, success); } }}; checkInvoke(a); }
invokeAll(tasks) with > 2 argument throws exception if any task does
RFCCF::testAbnormalInvokeAll3CC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAbnormalInvokeAllCollectionCC() { ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { FailingCCF f = new LFCCF(null, 8); CCF g = new LCCF(null, 9); CCF h = new LCCF(null, 7); HashSet set = new HashSet(); set.add(f); set.add(g); set.add(h); try { invokeAll(set); shouldThrow(); } catch (FJException success) { checkCompletedAbnormally(f, success); } }}; checkInvoke(a); }
invokeAll(collection) throws exception if any task does
RFCCF::testAbnormalInvokeAllCollectionCC
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAwaitQuiescence1() throws Exception { final ForkJoinPool p = new ForkJoinPool(); try (PoolCleaner cleaner = cleaner(p)) { final long startTime = System.nanoTime(); assertTrue(p.isQuiescent()); ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); assertSame(f, f.fork()); assertSame(p, ForkJoinTask.getPool()); boolean quiescent = p.awaitQuiescence(LONG_DELAY_MS, MILLISECONDS); assertTrue(quiescent); assertFalse(p.isQuiescent()); while (!f.isDone()) { assertFalse(p.getAsyncMode()); assertFalse(p.isShutdown()); assertFalse(p.isTerminating()); assertFalse(p.isTerminated()); Thread.yield(); } assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); assertFalse(p.isQuiescent()); assertEquals(0, ForkJoinTask.getQueuedTaskCount()); assertEquals(21, f.result); }}; p.execute(a); while (!a.isDone() || !p.isQuiescent()) { assertFalse(p.getAsyncMode()); assertFalse(p.isShutdown()); assertFalse(p.isTerminating()); assertFalse(p.isTerminated()); Thread.yield(); } assertEquals(0, p.getQueuedTaskCount()); assertFalse(p.getAsyncMode()); assertEquals(0, p.getQueuedSubmissionCount()); assertFalse(p.hasQueuedSubmissions()); while (p.getActiveThreadCount() != 0 && millisElapsedSince(startTime) < LONG_DELAY_MS) Thread.yield(); assertFalse(p.isShutdown()); assertFalse(p.isTerminating()); assertFalse(p.isTerminated()); assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); } }
awaitQuiescence by a worker is equivalent in effect to ForkJoinTask.helpQuiesce()
RFCCF::testAwaitQuiescence1
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testAwaitQuiescence2() throws Exception { /** * """It is possible to disable or limit the use of threads in the * common pool by setting the parallelism property to zero. However * doing so may cause unjoined tasks to never be executed.""" */ if ("0".equals(System.getProperty( "java.util.concurrent.ForkJoinPool.common.parallelism"))) return; final ForkJoinPool p = new ForkJoinPool(); try (PoolCleaner cleaner = cleaner(p)) { assertTrue(p.isQuiescent()); final long startTime = System.nanoTime(); ForkJoinTask a = new CheckedRecursiveAction() { protected void realCompute() { FibAction f = new FibAction(8); assertSame(f, f.fork()); while (!f.isDone() && millisElapsedSince(startTime) < LONG_DELAY_MS) { assertFalse(p.getAsyncMode()); assertFalse(p.isShutdown()); assertFalse(p.isTerminating()); assertFalse(p.isTerminated()); Thread.yield(); } assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); assertEquals(0, ForkJoinTask.getQueuedTaskCount()); assertEquals(21, f.result); }}; p.execute(a); assertTrue(p.awaitQuiescence(LONG_DELAY_MS, MILLISECONDS)); assertTrue(p.isQuiescent()); assertTrue(a.isDone()); assertEquals(0, p.getQueuedTaskCount()); assertFalse(p.getAsyncMode()); assertEquals(0, p.getQueuedSubmissionCount()); assertFalse(p.hasQueuedSubmissions()); while (p.getActiveThreadCount() != 0 && millisElapsedSince(startTime) < LONG_DELAY_MS) Thread.yield(); assertFalse(p.isShutdown()); assertFalse(p.isTerminating()); assertFalse(p.isTerminated()); assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); } }
awaitQuiescence returns when pool isQuiescent() or the indicated timeout elapsed
RFCCF::testAwaitQuiescence2
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ForkJoinPool8Test.java
Apache-2.0
public void testExecute() throws InterruptedException { final ThreadPoolExecutor p = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); try (PoolCleaner cleaner = cleaner(p)) { final CountDownLatch done = new CountDownLatch(1); final Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); }}; p.execute(task); assertTrue(done.await(LONG_DELAY_MS, MILLISECONDS)); } }
execute successfully executes a runnable
FailingThreadFactory::testExecute
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ThreadPoolExecutorTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ThreadPoolExecutorTest.java
Apache-2.0
public void testGetActiveCount() throws InterruptedException { final CountDownLatch done = new CountDownLatch(1); final ThreadPoolExecutor p = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); try (PoolCleaner cleaner = cleaner(p, done)) { final CountDownLatch threadStarted = new CountDownLatch(1); assertEquals(0, p.getActiveCount()); p.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { threadStarted.countDown(); assertEquals(1, p.getActiveCount()); await(done); }}); await(threadStarted); assertEquals(1, p.getActiveCount()); } }
getActiveCount increases but doesn't overestimate, when a thread becomes active
FailingThreadFactory::testGetActiveCount
java
google/j2objc
jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ThreadPoolExecutorTest.java
https://github.com/google/j2objc/blob/master/jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ThreadPoolExecutorTest.java
Apache-2.0