Skip to content

Commit

Permalink
Make IntListTest values relative to constants in IntList
Browse files Browse the repository at this point in the history
  • Loading branch information
Piyush Narang committed Apr 19, 2016
1 parent 9617015 commit d1b4df1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Expand Up @@ -31,8 +31,8 @@
*/
public class IntList {

private static final int MAX_SLAB_SIZE = 64 * 1024;
private static final int INITIAL_SLAB_SIZE = 4 * 1024;
public static final int MAX_SLAB_SIZE = 64 * 1024;
public static final int INITIAL_SLAB_SIZE = 4 * 1024;

//Double slab size till we reach the max slab size. At that point we just add slabs of size
//MAX_SLAB_SIZE. This ensures we don't allocate very large slabs from the start if we don't have
Expand Down
Expand Up @@ -25,30 +25,30 @@
public class IntListTest {

/**
* Test IntList of fairly small size (< 4K), this tests a single slab being created
* Test IntList of fairly small size (< INITIAL_SLAB_SIZE), this tests a single slab being created
*/
@Test
public void testSmallList() {
int testSize = 100;
int testSize = IntList.INITIAL_SLAB_SIZE - 100;
doTestIntList(testSize);
}

/**
* Test IntList > 4K so that we have multiple slabs being created
* Test IntList > INITIAL_SLAB_SIZE so that we have multiple slabs being created
*/
@Test
public void testListGreaterThan4K() {
int testSize = 6000;
public void testListGreaterThanInitialSlabSize() {
int testSize = IntList.INITIAL_SLAB_SIZE + 100;
doTestIntList(testSize);
}

/**
* Test IntList of a fairly large size (> 300K) so that we have multiple slabs
* Test IntList of a fairly large size (> MAX_SLAB_SIZE) so that we have multiple slabs
* created of varying sizes
*/
@Test
public void testListGreaterThan300K() {
int testSize = 310000;
public void testListGreaterThanMaxSlabSize() {
int testSize = IntList.MAX_SLAB_SIZE * 4 + 100;
doTestIntList(testSize);
}

Expand Down

0 comments on commit d1b4df1

Please sign in to comment.