use of module.LongTest in project solution-finder by knewjade.
the class PercentCountCaseTest method hold1.
@ParameterizedTest
@ArgumentsSource(Hold1TestCase.class)
@LongTest
void hold1(String command, int success, int all) throws Exception {
Log log = RunnerHelper.runnerCatchingLog(() -> EntryPointMain.main(command.split(" ")));
assertThat(log.getOutput()).contains(Messages.useHold()).contains(Messages.success(success, all));
}
use of module.LongTest in project solution-finder by knewjade.
the class PercentCountCaseTest method hold2.
@ParameterizedTest
@ArgumentsSource(Hold2TestCase.class)
@LongTest
void hold2(String command, int success, int all) throws Exception {
Log log = RunnerHelper.runnerCatchingLog(() -> EntryPointMain.main(command.split(" ")));
assertThat(log.getOutput()).contains(Messages.useHold()).contains(Messages.success(success, all));
}
use of module.LongTest in project solution-finder by knewjade.
the class PercentCountCaseTest method noHold1.
@ParameterizedTest
@ArgumentsSource(NoHold1TestCase.class)
@LongTest
void noHold1(String command, int success, int all) throws Exception {
Log log = RunnerHelper.runnerCatchingLog(() -> EntryPointMain.main(command.split(" ")));
assertThat(log.getOutput()).contains(Messages.noUseHold()).contains(Messages.success(success, all));
}
use of module.LongTest in project solution-finder by knewjade.
the class PercentCountCaseTest method noHold2.
@ParameterizedTest
@ArgumentsSource(NoHold2TestCase.class)
@LongTest
void noHold2(String command, int success, int all) throws Exception {
Log log = RunnerHelper.runnerCatchingLog(() -> EntryPointMain.main(command.split(" ")));
assertThat(log.getOutput()).contains(Messages.noUseHold()).contains(Messages.success(success, all));
}
use of module.LongTest in project solution-finder by knewjade.
the class BuildUpTest method cansBuildRandomLongByCheck.
@Test
@LongTest
void cansBuildRandomLongByCheck() {
Randoms randoms = new Randoms();
// Create field
int height = 4;
// Initialize
MinoFactory minoFactory = new MinoFactory();
MinoShifter minoShifter = new MinoShifter();
MinoRotation minoRotation = new MinoRotation();
PerfectValidator validator = new PerfectValidator();
CheckerUsingHold<Action> checker = new CheckerUsingHold<>(minoFactory, validator);
Candidate<Action> candidate = new LockedCandidate(minoFactory, minoShifter, minoRotation, height);
LockedReachable reachable = new LockedReachable(minoFactory, minoShifter, minoRotation, height);
AtomicInteger counter = new AtomicInteger();
for (int count = 0; count < 100; count++) {
// Pickup solution from checker
int numOfMinos = randoms.nextIntClosed(7, 10);
Field field = randoms.field(height, numOfMinos);
List<Piece> pieces = randoms.blocks(numOfMinos);
boolean check = checker.check(field, pieces, candidate, height, numOfMinos);
if (check) {
counter.incrementAndGet();
Stream<Operation> operationStream = ResultHelper.createOperationStream(checker.getResult());
Operations operations = new Operations(operationStream);
List<MinoOperationWithKey> operationWithKeys = OperationTransform.parseToOperationWithKeys(field, operations, minoFactory, height);
assertThat(BuildUp.cansBuild(field, operationWithKeys, height, reachable)).as(FieldView.toString(field) + pieces).isTrue();
}
}
System.out.println(counter);
}
Aggregations