use of org.junit.jupiter.params.provider.ArgumentsSource in project solution-finder by knewjade.
the class CheckerUsingHoldInvokerTest 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(1700 / 2520.0);
}
use of org.junit.jupiter.params.provider.ArgumentsSource in project solution-finder by knewjade.
the class CheckerUsingHoldInvokerTest method testSearch11.
@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch11(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p5");
int maxClearLine = 4;
int maxDepth = 4;
String marks = "" + "XXXX______" + "XXXXXXXXXX" + "XXXXX_____" + "XXXX_____X" + "";
ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
// Source: myself 20170707
assertThat(tree.getSuccessPercent()).isEqualTo(1758 / 2520.0);
}
use of org.junit.jupiter.params.provider.ArgumentsSource in project solution-finder by knewjade.
the class CheckerUsingHoldInvokerTest 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 20170415
assertThat(tree.getSuccessPercent()).isEqualTo(5038 / 5040.0);
}
use of org.junit.jupiter.params.provider.ArgumentsSource in project solution-finder by knewjade.
the class CheckmateUsingHoldTest method testCaseList.
@ParameterizedTest
@ArgumentsSource(TestCase.class)
@LongTest
void testCaseList(Pieces pieces, int expectedCount) throws Exception {
// 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();
// 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);
}
use of org.junit.jupiter.params.provider.ArgumentsSource in project siesta by cadenzauk.
the class DatabaseIntegrationTest method currentTimestampLocalTest.
@ParameterizedTest
@ArgumentsSource(TestCaseArgumentsProvider.class)
@TestCase({ "America/Anchorage" })
@TestCase({ "America/Sao_Paulo" })
@TestCase({ "UTC" })
@TestCase({ "Europe/London" })
@TestCase({ "Africa/Johannesburg" })
@TestCase({ "Pacific/Chatham" })
void currentTimestampLocalTest(String timeZone) {
Database database = testDatabase(dataSource, dialect);
try (UncheckedAutoCloseable ignored = TemporalTestUtil.withTimeZone(timeZone)) {
LocalDateTime before = LocalDateTime.now(database.databaseTimeZone()).minusSeconds(10);
LocalDateTime now = database.select(currentTimestampLocal()).single();
LocalDateTime after = LocalDateTime.now(database.databaseTimeZone()).plusSeconds(10);
System.out.printf("%s <= %s <= %s%n", before, now, after);
assertThat(before.isAfter(now), is(false));
assertThat(now.isAfter(after), is(false));
}
}
Aggregations