--- jsr166/src/test/tck/AtomicLongTest.java 2003/12/29 19:05:40 1.7 +++ jsr166/src/test/tck/AtomicLongTest.java 2005/05/25 14:27:37 1.10 @@ -46,6 +46,20 @@ public class AtomicLongTest extends JSR1 assertEquals(-3,ai.get()); } + + /** + * get returns the last value lazySet in same thread + */ + public void testGetLazySet(){ + AtomicLong ai = new AtomicLong(1); + assertEquals(1,ai.get()); + ai.lazySet(2); + assertEquals(2,ai.get()); + ai.lazySet(-3); + assertEquals(-3,ai.get()); + + } + /** * compareAndSet succeeds in changing value if equal to expected else fails */ @@ -198,4 +212,49 @@ public class AtomicLongTest extends JSR1 } } + /** + * toString returns current value. + */ + public void testToString() { + AtomicLong ai = new AtomicLong(); + for (long i = -12; i < 6; ++i) { + ai.set(i); + assertEquals(ai.toString(), Long.toString(i)); + } + } + + /** + * longValue returns current value. + */ + public void testLongValue() { + AtomicLong ai = new AtomicLong(); + for (int i = -12; i < 6; ++i) { + ai.set(i); + assertEquals((long)i, ai.longValue()); + } + } + + /** + * floatValue returns current value. + */ + public void testFloatValue() { + AtomicLong ai = new AtomicLong(); + for (int i = -12; i < 6; ++i) { + ai.set(i); + assertEquals((float)i, ai.floatValue()); + } + } + + /** + * doubleValue returns current value. + */ + public void testDoubleValue() { + AtomicLong ai = new AtomicLong(); + for (int i = -12; i < 6; ++i) { + ai.set(i); + assertEquals((double)i, ai.doubleValue()); + } + } + + }