Skip to content

Commit b11846e

Browse files
author
George Bouroutzoglou
committed
added test for copy constructor and a few comments
and changed test size to 200 elements per test
1 parent 8f58750 commit b11846e

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/test/java/gr/geompokon/bitarray/BitArrayTest.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@
2626

2727
class BitArrayTest {
2828

29-
final static int MAX_TEST_SIZE = 500;
29+
final static int MAX_TEST_SIZE = 200;
3030

3131
static BitArray bitArray;
3232
static ArrayList<Boolean> boolArray;
3333
static Random random;
3434

35+
/**
36+
* Start each test with a fresh array
37+
*/
3538
@BeforeEach
3639
void setUp() {
3740
bitArray = new BitArray();
@@ -62,12 +65,23 @@ void myAssertSameArrays() {
6265
assertEquals(boolArray, bitArray);
6366
}
6467

68+
/**
69+
* Make the bit array from the boolean array
70+
*/
71+
@Test
72+
void testCopyConstructor() {
73+
initArrays(MAX_TEST_SIZE);
74+
bitArray.clear();
75+
76+
bitArray = new BitArray(boolArray);
77+
myAssertSameArrays();
78+
}
79+
6580
@Test
6681
void testClone() {
6782
initArrays(MAX_TEST_SIZE);
6883
BitArray clone = bitArray.clone();
6984

70-
assertEquals(clone, bitArray);
7185
assertEquals(bitArray, clone);
7286
}
7387

0 commit comments

Comments
 (0)