Search in sources :

Example 16 with ParameterizedTest

use of org.junit.jupiter.params.ParameterizedTest in project solution-finder by knewjade.

the class CheckmateNoHoldTest method testCaseList.

@ParameterizedTest
@ArgumentsSource(TestCase.class)
@LongTest
void testCaseList(Pieces pieces, int expectedCount) {
    // Field
    int maxClearLine = 4;
    int maxDepth = 10;
    Field field = FieldFactory.createField(maxClearLine);
    // Initialize
    Candidate<Action> candidate = new LockedCandidate(minoFactory, minoShifter, minoRotation, maxClearLine);
    LockedReachable reachable = new LockedReachable(minoFactory, minoShifter, minoRotation, maxClearLine);
    // Assertion
    // Set test case
    List<Piece> piecesList = pieces.getPieces();
    System.out.println(piecesList);
    // Execute
    List<Result> results = checkmate.search(field, piecesList, candidate, maxClearLine, maxDepth);
    assertThat(results).as(piecesList.toString()).hasSize(expectedCount);
    // Check result
    for (Result result : results) assertResult(result, field, maxClearLine, reachable, piecesList);
}
Also used : Field(core.field.Field) LockedCandidate(core.action.candidate.LockedCandidate) Action(common.datastore.action.Action) Piece(core.mino.Piece) LockedReachable(core.action.reachable.LockedReachable) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) LongTest(module.LongTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Example 17 with ParameterizedTest

use of org.junit.jupiter.params.ParameterizedTest in project solution-finder by knewjade.

the class CheckerNoHoldInvokerTest method testSearch3.

@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch3(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
    PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p7");
    int maxClearLine = 4;
    int maxDepth = 7;
    String marks = "" + "X_________" + "X___X_____" + "XXXXXXX___" + "XXXXXX____" + "";
    // 結果を集計する
    ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
    AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
    // Source: myself 20170415
    assertThat(tree.getSuccessPercent()).isEqualTo(727 / 5040.0);
}
Also used : PatternGenerator(common.pattern.PatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) AnalyzeTree(common.tree.AnalyzeTree) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Example 18 with ParameterizedTest

use of org.junit.jupiter.params.ParameterizedTest in project solution-finder by knewjade.

the class CheckerNoHoldInvokerTest method testSearch7.

@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch7(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
    PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p5");
    int maxClearLine = 4;
    int maxDepth = 4;
    String marks = "" + "XXXXX_____" + "XXXXXX____" + "XXXXXXX___" + "XXXXXX____" + "";
    ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
    AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
    // Source: twitter by @???
    assertThat(tree.getSuccessPercent()).isEqualTo(396 / 2520.0);
}
Also used : PatternGenerator(common.pattern.PatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) AnalyzeTree(common.tree.AnalyzeTree) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Example 19 with ParameterizedTest

use of org.junit.jupiter.params.ParameterizedTest in project solution-finder by knewjade.

the class CheckerNoHoldInvokerTest method testSearch4.

@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch4(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
    PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p4");
    int maxClearLine = 3;
    int maxDepth = 3;
    String marks = "" + "XXX____XXX" + "XXX_____XX" + "XXXX___XXX" + "";
    ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
    AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
    // Source: myself 20170415
    assertThat(tree.getSuccessPercent()).isEqualTo(120 / 840.0);
}
Also used : PatternGenerator(common.pattern.PatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) AnalyzeTree(common.tree.AnalyzeTree) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Example 20 with ParameterizedTest

use of org.junit.jupiter.params.ParameterizedTest in project solution-finder by knewjade.

the class CheckerNoHoldInvokerTest method testSearch6.

@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch6(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
    PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p5");
    int maxClearLine = 4;
    int maxDepth = 4;
    String marks = "" + "XXXXXX____" + "XXXXXX____" + "XXXXXX____" + "XXXXXX____" + "";
    ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
    AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
    // Source: twitter by @???
    assertThat(tree.getSuccessPercent()).isEqualTo(516 / 2520.0);
}
Also used : PatternGenerator(common.pattern.PatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) AnalyzeTree(common.tree.AnalyzeTree) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Aggregations

ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1880 MethodSource (org.junit.jupiter.params.provider.MethodSource)1020 EnumSource (org.junit.jupiter.params.provider.EnumSource)321 ValueSource (org.junit.jupiter.params.provider.ValueSource)270 ArgumentsSource (org.junit.jupiter.params.provider.ArgumentsSource)181 Transaction (org.neo4j.graphdb.Transaction)117 ArrayList (java.util.ArrayList)97 ByteBuffer (java.nio.ByteBuffer)78 CsvSource (org.junit.jupiter.params.provider.CsvSource)78 Path (java.nio.file.Path)71 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)67 IOException (java.io.IOException)65 List (java.util.List)59 Test (org.junit.jupiter.api.Test)58 HashMap (java.util.HashMap)55 Map (java.util.Map)54 HashSet (java.util.HashSet)52 lombok.val (lombok.val)52 SelfSignedCertificate (io.netty.handler.ssl.util.SelfSignedCertificate)50 TimeUnit (java.util.concurrent.TimeUnit)48