Skip to content

Commit

Permalink
parameterize RandomQuerySelectorTest
Browse files Browse the repository at this point in the history
  • Loading branch information
nck-mlcnv committed Oct 12, 2023
1 parent e9d2bad commit 26563a6
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.aksw.iguana.cc.query.selector.impl;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

import static org.junit.jupiter.api.Assertions.*;

Expand All @@ -16,16 +18,18 @@ public void testGetIndex() {
}
}

@Test
public void testThrowingOnIllegalSize() {
@ParameterizedTest
@ValueSource(ints = {-1, 0})
public void testThrowingOnIllegalSize(int size) {
assertThrows(IllegalArgumentException.class, () -> new RandomQuerySelector(-1, 0));
assertThrows(IllegalArgumentException.class, () -> new RandomQuerySelector(0, 0));
}

@Test
public void testSeedConsistency() {
final var selector = new RandomQuerySelector(100000, 0);
final var selector2 = new RandomQuerySelector(100000, 0);
@ParameterizedTest
@ValueSource(ints = {1, 2, 3, 100000})
public void testSeedConsistency(int size) {
final var selector = new RandomQuerySelector(size, 0);
final var selector2 = new RandomQuerySelector(size, 0);
for (int i = 0; i < 100000; i++) {
final var nextIndex = selector.getNextIndex();
final var nextIndex2 = selector2.getNextIndex();
Expand Down

0 comments on commit 26563a6

Please sign in to comment.