Skip to content

Commit

Permalink
Define STREAM parameter locally on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gstamatelat committed Jul 2, 2018
1 parent e10db8a commit cb99bec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
13 changes: 8 additions & 5 deletions src/test/java/gr/james/sampling/RandomSamplingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class RandomSamplingTest {

private static final Random RANDOM = new Random();

private static final int STREAM = 20;
private static final int SAMPLE = 10;
private static final int REPS = 1000000;

Expand All @@ -40,10 +39,12 @@ public static Collection<Supplier<RandomSampling<Integer>>> implementations() {
}

/**
* All items must be selected with equal probability.
* All items must be selected with equal probability. Using 20 stream elements.
*/
@Test
public void correctness() {
public void correctness20() {
final int STREAM = 20;

final int[] d = new int[STREAM];

for (int reps = 0; reps < REPS; reps++) {
Expand All @@ -66,10 +67,12 @@ public void correctness() {
}

/**
* Same test as {@link #correctness()} but with the stream API.
* Same test as {@link #correctness20()} but with the stream API. Using 20 stream elements.
*/
@Test
public void stream() {
public void stream20() {
final int STREAM = 20;

final int[] d = new int[STREAM];

for (int reps = 0; reps < REPS; reps++) {
Expand Down
13 changes: 8 additions & 5 deletions src/test/java/gr/james/sampling/WeightedRandomSamplingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class WeightedRandomSamplingTest {

private static final Random RANDOM = new Random();

private static final int STREAM = 20;
private static final int SAMPLE = 10;
private static final int REPS = 1000000;

Expand All @@ -37,10 +36,12 @@ public static Collection<Supplier<WeightedRandomSampling<Integer>>> implementati
}

/**
* Increased weight means more occurrences.
* Increased weight means more occurrences. Using 20 stream elements.
*/
@Test
public void correctness() {
public void correctness20() {
final int STREAM = 20;

final int[] d = new int[STREAM];

for (int reps = 0; reps < REPS; reps++) {
Expand All @@ -61,10 +62,12 @@ public void correctness() {
}

/**
* Same test as {@link #correctness()} but with the stream API.
* Same test as {@link #correctness20()} but with the stream API. Using 20 stream elements.
*/
@Test
public void stream() {
public void stream20() {
final int STREAM = 20;

final int[] d = new int[STREAM];

for (int reps = 0; reps < REPS; reps++) {
Expand Down

0 comments on commit cb99bec

Please sign in to comment.