--- jsr166/src/test/tck/AtomicLongArrayTest.java 2016/06/17 01:38:28 1.34 +++ jsr166/src/test/tck/AtomicLongArrayTest.java 2016/06/17 19:00:48 1.35 @@ -85,54 +85,6 @@ public class AtomicLongArrayTest extends aa.addAndGet(index, 1); shouldThrow(); } catch (IndexOutOfBoundsException success) {} - try { - aa.getPlain(index); - shouldThrow(); - } catch (IndexOutOfBoundsException success) {} - try { - aa.getOpaque(index); - shouldThrow(); - } catch (IndexOutOfBoundsException success) {} - try { - aa.getAcquire(index); - shouldThrow(); - } catch (IndexOutOfBoundsException success) {} - try { - aa.setPlain(index, 1); - shouldThrow(); - } catch (IndexOutOfBoundsException success) {} - try { - aa.setOpaque(index, 1); - shouldThrow(); - } catch (IndexOutOfBoundsException success) {} - try { - aa.setRelease(index, 1); - shouldThrow(); - } catch (IndexOutOfBoundsException success) {} - try { - aa.compareAndExchange(index, 1, 2); - shouldThrow(); - } catch (IndexOutOfBoundsException success) {} - try { - aa.compareAndExchangeAcquire(index, 1, 2); - shouldThrow(); - } catch (IndexOutOfBoundsException success) {} - try { - aa.compareAndExchangeRelease(index, 1, 2); - shouldThrow(); - } catch (IndexOutOfBoundsException success) {} - try { - aa.weakCompareAndSetVolatile(index, 1, 2); - shouldThrow(); - } catch (IndexOutOfBoundsException success) {} - try { - aa.weakCompareAndSetAcquire(index, 1, 2); - shouldThrow(); - } catch (IndexOutOfBoundsException success) {} - try { - aa.weakCompareAndSetRelease(index, 1, 2); - shouldThrow(); - } catch (IndexOutOfBoundsException success) {} } } @@ -387,198 +339,4 @@ public class AtomicLongArrayTest extends assertEquals(Arrays.toString(a), aa.toString()); } - // jdk9 - - /** - * getPlain returns the last value set - */ - public void testGetPlainSet() { - AtomicLongArray aa = new AtomicLongArray(SIZE); - for (int i = 0; i < SIZE; i++) { - aa.set(i, 1); - assertEquals(1, aa.getPlain(i)); - aa.set(i, 2); - assertEquals(2, aa.getPlain(i)); - aa.set(i, -3); - assertEquals(-3, aa.getPlain(i)); - } - } - - /** - * getOpaque returns the last value set - */ - public void testGetOpaqueSet() { - AtomicLongArray aa = new AtomicLongArray(SIZE); - for (int i = 0; i < SIZE; i++) { - aa.set(i, 1); - assertEquals(1, aa.getOpaque(i)); - aa.set(i, 2); - assertEquals(2, aa.getOpaque(i)); - aa.set(i, -3); - assertEquals(-3, aa.getOpaque(i)); - } - } - - /** - * getAcquire returns the last value set - */ - public void testGetAcquireSet() { - AtomicLongArray aa = new AtomicLongArray(SIZE); - for (int i = 0; i < SIZE; i++) { - aa.set(i, 1); - assertEquals(1, aa.getAcquire(i)); - aa.set(i, 2); - assertEquals(2, aa.getAcquire(i)); - aa.set(i, -3); - assertEquals(-3, aa.getAcquire(i)); - } - } - - /** - * get returns the last value setPlain - */ - public void testGetSetPlain() { - AtomicLongArray aa = new AtomicLongArray(SIZE); - for (int i = 0; i < SIZE; i++) { - aa.setPlain(i, 1); - assertEquals(1, aa.get(i)); - aa.setPlain(i, 2); - assertEquals(2, aa.get(i)); - aa.setPlain(i, -3); - assertEquals(-3, aa.get(i)); - } - } - - /** - * get returns the last value setOpaque - */ - public void testGetSetOpaque() { - AtomicLongArray aa = new AtomicLongArray(SIZE); - for (int i = 0; i < SIZE; i++) { - aa.setOpaque(i, 1); - assertEquals(1, aa.get(i)); - aa.setOpaque(i, 2); - assertEquals(2, aa.get(i)); - aa.setOpaque(i, -3); - assertEquals(-3, aa.get(i)); - } - } - - /** - * get returns the last value setRelease - */ - public void testGetSetRelease() { - AtomicLongArray aa = new AtomicLongArray(SIZE); - for (int i = 0; i < SIZE; i++) { - aa.setRelease(i, 1); - assertEquals(1, aa.get(i)); - aa.setRelease(i, 2); - assertEquals(2, aa.get(i)); - aa.setRelease(i, -3); - assertEquals(-3, aa.get(i)); - } - } - - /** - * compareAndExchange succeeds in changing value if equal to - * expected else fails - */ - public void testCompareAndExchange() { - AtomicLongArray aa = new AtomicLongArray(SIZE); - for (int i = 0; i < SIZE; i++) { - aa.set(i, 1); - assertEquals(1, aa.compareAndExchange(i, 1, 2)); - assertEquals(2, aa.compareAndExchange(i, 2, -4)); - assertEquals(-4, aa.get(i)); - assertEquals(-4, aa.compareAndExchange(i,-5, 7)); - assertEquals(-4, aa.get(i)); - assertEquals(-4, aa.compareAndExchange(i, -4, 7)); - assertEquals(7, aa.get(i)); - } - } - - /** - * compareAndExchangeAcquire succeeds in changing value if equal to - * expected else fails - */ - public void testCompareAndExchangeAcquire() { - AtomicLongArray aa = new AtomicLongArray(SIZE); - for (int i = 0; i < SIZE; i++) { - aa.set(i, 1); - assertEquals(1, aa.compareAndExchangeAcquire(i, 1, 2)); - assertEquals(2, aa.compareAndExchangeAcquire(i, 2, -4)); - assertEquals(-4, aa.get(i)); - assertEquals(-4, aa.compareAndExchangeAcquire(i,-5, 7)); - assertEquals(-4, aa.get(i)); - assertEquals(-4, aa.compareAndExchangeAcquire(i, -4, 7)); - assertEquals(7, aa.get(i)); - } - } - - /** - * compareAndExchangeRelease succeeds in changing value if equal to - * expected else fails - */ - public void testCompareAndExchangeRelease() { - AtomicLongArray aa = new AtomicLongArray(SIZE); - for (int i = 0; i < SIZE; i++) { - aa.set(i, 1); - assertEquals(1, aa.compareAndExchangeRelease(i, 1, 2)); - assertEquals(2, aa.compareAndExchangeRelease(i, 2, -4)); - assertEquals(-4, aa.get(i)); - assertEquals(-4, aa.compareAndExchangeRelease(i,-5, 7)); - assertEquals(-4, aa.get(i)); - assertEquals(-4, aa.compareAndExchangeRelease(i, -4, 7)); - assertEquals(7, aa.get(i)); - } - } - - /** - * repeated weakCompareAndSetVolatile succeeds in changing value when equal - * to expected - */ - public void testWeakCompareAndSetVolatile() { - AtomicLongArray aa = new AtomicLongArray(SIZE); - for (int i = 0; i < SIZE; i++) { - aa.set(i, 1); - do {} while (!aa.weakCompareAndSetVolatile(i, 1, 2)); - do {} while (!aa.weakCompareAndSetVolatile(i, 2, -4)); - assertEquals(-4, aa.get(i)); - do {} while (!aa.weakCompareAndSetVolatile(i, -4, 7)); - assertEquals(7, aa.get(i)); - } - } - - /** - * repeated weakCompareAndSetAcquire succeeds in changing value when equal - * to expected - */ - public void testWeakCompareAndSetAcquire() { - AtomicLongArray aa = new AtomicLongArray(SIZE); - for (int i = 0; i < SIZE; i++) { - aa.set(i, 1); - do {} while (!aa.weakCompareAndSetAcquire(i, 1, 2)); - do {} while (!aa.weakCompareAndSetAcquire(i, 2, -4)); - assertEquals(-4, aa.get(i)); - do {} while (!aa.weakCompareAndSetAcquire(i, -4, 7)); - assertEquals(7, aa.get(i)); - } - } - - /** - * repeated weakCompareAndSetRelease succeeds in changing value when equal - * to expected - */ - public void testWeakCompareAndSetRelease() { - AtomicLongArray aa = new AtomicLongArray(SIZE); - for (int i = 0; i < SIZE; i++) { - aa.set(i, 1); - do {} while (!aa.weakCompareAndSetRelease(i, 1, 2)); - do {} while (!aa.weakCompareAndSetRelease(i, 2, -4)); - assertEquals(-4, aa.get(i)); - do {} while (!aa.weakCompareAndSetRelease(i, -4, 7)); - assertEquals(7, aa.get(i)); - } - } - }