use of org.junit.jupiter.params.provider.ArgumentsSource in project solution-finder by knewjade.
the class CheckerUsingHoldTest method testNoPossiblePerfect.
@ParameterizedTest
@ArgumentsSource(TestCase.class)
@LongTest
void testNoPossiblePerfect(LongPieces pieces) throws Exception {
// Field
Field field = FieldFactory.createSmallField();
int maxClearLine = 4;
int maxDepth = 10;
// Initialize
Candidate<Action> candidate = new LockedCandidate(minoFactory, minoShifter, minoRotation, maxClearLine);
LockedReachable reachable = new LockedReachable(minoFactory, minoShifter, minoRotation, maxClearLine);
// Assertion
// Set test case
List<Piece> blocks = pieces.getPieces();
// Execute
boolean isSucceed = checker.check(field, blocks, candidate, maxClearLine, maxDepth);
assertThat(isSucceed).isFalse();
// Check result
if (isSucceed)
assertResult(field, maxClearLine, reachable, blocks);
}
use of org.junit.jupiter.params.provider.ArgumentsSource in project solution-finder by knewjade.
the class LockedNeighborCandidateTest method testField.
@ParameterizedTest
@ArgumentsSource(FieldTestCase.class)
void testField(Field field, Piece piece) {
Injector injector = Guice.createInjector(new BasicModule());
int maxClearLine = 4;
LockedCandidate candidate1 = createLockedCandidate(injector, maxClearLine);
LockedNeighborCandidate candidate2 = createLockedNeighborCandidate(injector, maxClearLine);
MinoShifter minoShifter = injector.getInstance(MinoShifter.class);
// LockedCandidate
Set<Action> search1 = candidate1.search(field, piece, maxClearLine);
// LockedNeighborCandidate
Set<Neighbor> neighbors = candidate2.search(field, piece, maxClearLine);
Set<Action> search2 = neighbors.stream().map(Neighbor::getPiece).map(this::createMinimalAction).map(action -> minoShifter.createTransformedAction(piece, action)).collect(Collectors.toSet());
assertThat(search2).isEqualTo(search1);
}
use of org.junit.jupiter.params.provider.ArgumentsSource in project solution-finder by knewjade.
the class CheckerNoHoldInvokerTest method testSearch9.
@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch9(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p5");
int maxClearLine = 4;
int maxDepth = 4;
String marks = "" + "XXXXXX____" + "XXXXX_____" + "XXXXXXX___" + "XXXXXX____" + "";
ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
// Source: twitter by @???
assertThat(tree.getSuccessPercent()).isEqualTo(324 / 2520.0);
}
use of org.junit.jupiter.params.provider.ArgumentsSource in project solution-finder by knewjade.
the class CheckerNoHoldInvokerTest method testCase13.
@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testCase13(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
// Invoker
PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p7");
int maxClearLine = 4;
int maxDepth = 6;
// Field
String marks = "" + "XXXX______" + "XXXX______" + "XXXX______" + "XXXX______" + "";
ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
// Source: myself 20170415
assertThat(tree.getSuccessPercent()).isEqualTo(1902 / 5040.0);
}
use of org.junit.jupiter.params.provider.ArgumentsSource in project solution-finder by knewjade.
the class CheckerNoHoldInvokerTest method testSearch2BT4_5.
@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch2BT4_5(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p7");
int maxClearLine = 6;
int maxDepth = 7;
String marks = "" + "XX________" + "XX________" + "XXX______X" + "XXXXXXX__X" + "XXXXXX___X" + "XXXXXXX_XX" + "";
// 結果を集計する
ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
// Source: myself 20170616
assertThat(tree.getSuccessPercent()).isEqualTo(2228 / 5040.0);
}
Aggregations