Search in sources :

Example 6 with ArgumentsSource

use of org.junit.jupiter.params.provider.ArgumentsSource 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 7 with ArgumentsSource

use of org.junit.jupiter.params.provider.ArgumentsSource 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 8 with ArgumentsSource

use of org.junit.jupiter.params.provider.ArgumentsSource 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)

Example 9 with ArgumentsSource

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

the class CheckerNoHoldInvokerTest method testCase11.

@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testCase11(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
    // Invoker
    PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p4");
    int maxClearLine = 5;
    int maxDepth = 4;
    // Field
    String marks = "" + "____XXXXXX" + "____XXXXXX" + "___XXXXXXX" + "__XXXXXXXX" + "___XXXXXXX" + "";
    ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
    AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
    // Source: reply in twitter from @fullfool_14
    assertThat(tree.getSuccessPercent()).isEqualTo(477 / 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 10 with ArgumentsSource

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

the class CheckerNoHoldInvokerTest method testSearch10.

@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch10(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
    PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p7");
    int maxClearLine = 4;
    int maxDepth = 6;
    // Field
    String marks = "" + "X________X" + "X________X" + "XX______XX" + "XXXXXX__XX" + "";
    ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
    AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
    // Source: reply in twitter from @fullfool_14
    assertThat(tree.getSuccessPercent()).isEqualTo(1439 / 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)

Aggregations

ArgumentsSource (org.junit.jupiter.params.provider.ArgumentsSource)50 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)49 LoadedPatternGenerator (common.pattern.LoadedPatternGenerator)27 PatternGenerator (common.pattern.PatternGenerator)27 AnalyzeTree (common.tree.AnalyzeTree)27 LongTest (module.LongTest)16 Log (_usecase.Log)10 TestCase (com.cadenzauk.core.junit.TestCase)7 TestDatabase.testDatabase (com.cadenzauk.siesta.model.TestDatabase.testDatabase)7 Action (common.datastore.action.Action)7 Field (core.field.Field)7 UncheckedAutoCloseable (com.cadenzauk.core.lang.UncheckedAutoCloseable)6 LockedCandidate (core.action.candidate.LockedCandidate)6 Piece (core.mino.Piece)5 LockedReachable (core.action.reachable.LockedReachable)4 RandomValues.randomZonedDateTime (com.cadenzauk.core.RandomValues.randomZonedDateTime)3 TestRow (com.cadenzauk.siesta.model.TestRow)3 MinoFactory (core.mino.MinoFactory)3 MinoShifter (core.mino.MinoShifter)3 MinoRotation (core.srs.MinoRotation)3