public void test() { final AtomicIntChunks ic = new AtomicIntChunks(42); set(0, ic); check(ic); assertFalse(ic.compareAndSet(20, 20, 40)); assertEquals(21, ic.get(20)); assertTrue(ic.compareAndSet(20, 21, 40)); assertEquals(40, ic.get(20)); assertEquals(32, ic.fieldBits()); }
private static void check(final AtomicIntChunks lc) { for (int i = 0; i < lc.length(); i++) { assertEquals(i + 1, lc.get(i)); } }