|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AtomicLongArrayTest | Line # 14 | 166 | 54 | 93.1% |
0.93133044
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| AtomicLongArrayTest.Counter | Line # 268 | 12 | 7 | 100% |
1.0
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| (19) | |||
| Result | |||
|
0.14901961
|
AtomicLongArrayTest.testCountingInMultipleThreads
AtomicLongArrayTest.testCountingInMultipleThreads
|
1 PASS | |
|
0.07058824
|
AtomicLongArrayTest.testSerialization
AtomicLongArrayTest.testSerialization
|
1 PASS | |
|
0.06666667
|
AtomicLongArrayTest.testToString
AtomicLongArrayTest.testToString
|
1 PASS | |
|
0.05490196
|
AtomicLongArrayTest.testWeakCompareAndSet
AtomicLongArrayTest.testWeakCompareAndSet
|
1 PASS | |
|
0.050980393
|
AtomicLongArrayTest.testCompareAndSet
AtomicLongArrayTest.testCompareAndSet
|
1 PASS | |
|
0.050980393
|
AtomicLongArrayTest.testCompareAndSetInMultipleThreads
AtomicLongArrayTest.testCompareAndSetInMultipleThreads
|
1 PASS | |
|
0.050980393
|
AtomicLongArrayTest.testGetAndIncrement
AtomicLongArrayTest.testGetAndIncrement
|
1 PASS | |
|
0.050980393
|
AtomicLongArrayTest.testIncrementAndGet
AtomicLongArrayTest.testIncrementAndGet
|
1 PASS | |
|
0.043137256
|
AtomicLongArrayTest.testGetLazySet
AtomicLongArrayTest.testGetLazySet
|
1 PASS | |
|
0.043137256
|
AtomicLongArrayTest.testGetSet
AtomicLongArrayTest.testGetSet
|
1 PASS | |
|
0.039215688
|
AtomicLongArrayTest.testAddAndGet
AtomicLongArrayTest.testAddAndGet
|
1 PASS | |
|
0.039215688
|
AtomicLongArrayTest.testIndexing
AtomicLongArrayTest.testIndexing
|
1 PASS | |
|
0.039215688
|
AtomicLongArrayTest.testDecrementAndGet
AtomicLongArrayTest.testDecrementAndGet
|
1 PASS | |
|
0.039215688
|
AtomicLongArrayTest.testGetAndAdd
AtomicLongArrayTest.testGetAndAdd
|
1 PASS | |
|
0.03529412
|
AtomicLongArrayTest.testGetAndDecrement
AtomicLongArrayTest.testGetAndDecrement
|
1 PASS | |
|
0.03529412
|
AtomicLongArrayTest.testGetAndSet
AtomicLongArrayTest.testGetAndSet
|
1 PASS | |
|
0.03137255
|
AtomicLongArrayTest.testConstructor2
AtomicLongArrayTest.testConstructor2
|
1 PASS | |
|
0.023529412
|
AtomicLongArrayTest.testConstructor
AtomicLongArrayTest.testConstructor
|
1 PASS | |
|
0.015686275
|
AtomicLongArrayTest.testConstructor2NPE
AtomicLongArrayTest.testConstructor2NPE
|
1 PASS | |
| 1 | /* | |
| 2 | * Written by Doug Lea with assistance from members of JCP JSR-166 | |
| 3 | * Expert Group and released to the public domain, as explained at | |
| 4 | * http://creativecommons.org/licenses/publicdomain | |
| 5 | * Other contributors include Andrew Wright, Jeffrey Hayes, | |
| 6 | * Pat Fisher, Mike Judd. | |
| 7 | */ | |
| 8 | ||
| 9 | import junit.framework.*; | |
| 10 | import edu.emory.mathcs.backport.java.util.concurrent.atomic.*; | |
| 11 | import java.io.*; | |
| 12 | import edu.emory.mathcs.backport.java.util.*; | |
| 13 | ||
| 14 | public class AtomicLongArrayTest extends JSR166TestCase { | |
| 15 | 0 |
public static void main (String[] args) { |
| 16 | 0 | junit.textui.TestRunner.run (suite()); |
| 17 | } | |
| 18 | 1 |
public static Test suite() { |
| 19 | 1 | return new TestSuite(AtomicLongArrayTest.class); |
| 20 | } | |
| 21 | ||
| 22 | /** | |
| 23 | * constructor creates array of given size with all elements zero | |
| 24 | */ | |
| 25 | 1 |
public void testConstructor(){ |
| 26 | 1 | AtomicLongArray ai = new AtomicLongArray(SIZE); |
| 27 | 21 | for (int i = 0; i < SIZE; ++i) |
| 28 | 20 | assertEquals(0,ai.get(i)); |
| 29 | } | |
| 30 | ||
| 31 | /** | |
| 32 | * constructor with null array throws NPE | |
| 33 | */ | |
| 34 | 1 |
public void testConstructor2NPE() { |
| 35 | 1 | try { |
| 36 | 1 | long[] a = null; |
| 37 | 1 | AtomicLongArray ai = new AtomicLongArray(a); |
| 38 | } catch (NullPointerException success) { | |
| 39 | } catch (Exception ex) { | |
| 40 | 0 | unexpectedException(); |
| 41 | } | |
| 42 | } | |
| 43 | ||
| 44 | /** | |
| 45 | * constructor with array is of same size and has all elements | |
| 46 | */ | |
| 47 | 1 |
public void testConstructor2() { |
| 48 | 1 | long[] a = { 17L, 3L, -42L, 99L, -7L}; |
| 49 | 1 | AtomicLongArray ai = new AtomicLongArray(a); |
| 50 | 1 | assertEquals(a.length, ai.length()); |
| 51 | 6 | for (int i = 0; i < a.length; ++i) |
| 52 | 5 | assertEquals(a[i], ai.get(i)); |
| 53 | } | |
| 54 | ||
| 55 | /** | |
| 56 | * get and set for out of bound indices throw IndexOutOfBoundsException | |
| 57 | */ | |
| 58 | 1 |
public void testIndexing(){ |
| 59 | 1 | AtomicLongArray ai = new AtomicLongArray(SIZE); |
| 60 | 1 | try { |
| 61 | 1 | ai.get(SIZE); |
| 62 | } catch(IndexOutOfBoundsException success){ | |
| 63 | } | |
| 64 | 1 | try { |
| 65 | 1 | ai.get(-1); |
| 66 | } catch(IndexOutOfBoundsException success){ | |
| 67 | } | |
| 68 | 1 | try { |
| 69 | 1 | ai.set(SIZE, 0); |
| 70 | } catch(IndexOutOfBoundsException success){ | |
| 71 | } | |
| 72 | 1 | try { |
| 73 | 1 | ai.set(-1, 0); |
| 74 | } catch(IndexOutOfBoundsException success){ | |
| 75 | } | |
| 76 | } | |
| 77 | ||
| 78 | /** | |
| 79 | * get returns the last value set at index | |
| 80 | */ | |
| 81 | 1 |
public void testGetSet(){ |
| 82 | 1 | AtomicLongArray ai = new AtomicLongArray(SIZE); |