Search in sources :

Example 16 with LongTest

use of module.LongTest in project solution-finder by knewjade.

the class PathCountCaseTest method pattern6.

@Test
@LongTest
void pattern6() throws Exception {
    /*
            __________
            __________
            __________
            __________
             */
    String tetfu = "v115@vhAAgH";
    String command = String.format("path -p J,Z,O,S,L,I,I,J,S,O,Z -t %s", tetfu);
    Log log = RunnerHelper.runnerCatchingLog(() -> EntryPointMain.main(command.split(" ")));
    System.out.println(log.getOutput());
    assertThat(log.getReturnCode()).isEqualTo(0);
    assertThat(log.getOutput()).contains("J,Z,O,S,L,I,I,J,S,O,Z").contains(Messages.uniqueCount(71)).contains(Messages.minimalCount(1)).contains(Messages.useHold());
}
Also used : Log(_usecase.Log) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest) LongTest(module.LongTest)

Example 17 with LongTest

use of module.LongTest in project solution-finder by knewjade.

the class PathRandomFileCaseTest method hold1.

@ParameterizedTest
@ArgumentsSource(Hold1TestCase.class)
@LongTest
void hold1(String command, int unique) throws Exception {
    Log log = RunnerHelper.runnerCatchingLog(() -> EntryPointMain.main(command.split(" ")));
    assertThat(log.getOutput()).contains(Messages.useHold()).contains(Messages.uniqueCount(unique));
}
Also used : Log(_usecase.Log) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) LongTest(module.LongTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Example 18 with LongTest

use of module.LongTest in project solution-finder by knewjade.

the class PathRandomFileCaseTest method hold2.

@ParameterizedTest
@ArgumentsSource(Hold2TestCase.class)
@LongTest
void hold2(String command, int unique) throws Exception {
    Log log = RunnerHelper.runnerCatchingLog(() -> EntryPointMain.main(command.split(" ")));
    assertThat(log.getOutput()).contains(Messages.useHold()).contains(Messages.uniqueCount(unique));
}
Also used : Log(_usecase.Log) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) LongTest(module.LongTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Example 19 with LongTest

use of module.LongTest in project solution-finder by knewjade.

the class PathRandomPatternFileCasesTest method reserved.

@ParameterizedTest
@ArgumentsSource(ReservedTestCase.class)
@LongTest
void reserved(String command, int unique, int success, int all) throws Exception {
    Log log = RunnerHelper.runnerCatchingLog(() -> EntryPointMain.main(command.split(" ")));
    assertThat(log.getOutput()).contains(Messages.pathCount(unique)).contains(Messages.success(success, all));
}
Also used : Log(_usecase.Log) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) LongTest(module.LongTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Example 20 with LongTest

use of module.LongTest in project solution-finder by knewjade.

the class PermutationIterableTest method iteratorRandomBlock.

@Test
@LongTest
void iteratorRandomBlock() throws Exception {
    Randoms randoms = new Randoms();
    ArrayList<Piece> allPieces = Lists.newArrayList(Iterables.concat(Piece.valueList(), Piece.valueList()));
    for (int pop = 1; pop <= 7; pop++) {
        PermutationIterable<Piece> iterable = new PermutationIterable<>(allPieces, pop);
        HashSet<LongPieces> sets = StreamSupport.stream(iterable.spliterator(), false).map(Collection::stream).map(LongPieces::new).collect(Collectors.toCollection(HashSet::new));
        // ランダムにサンプルを選択し、必ず列挙したセットの中にあることを確認
        for (int count = 0; count < 1000; count++) {
            List<Piece> sample = randoms.sample(allPieces, pop);
            LongPieces pieces = new LongPieces(sample);
            assertThat(pieces).isIn(sets);
        }
    }
}
Also used : Randoms(lib.Randoms) Piece(core.mino.Piece) LongPieces(common.datastore.blocks.LongPieces) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest) LongTest(module.LongTest)

Aggregations

LongTest (module.LongTest)44 Test (org.junit.jupiter.api.Test)28 Piece (core.mino.Piece)26 Field (core.field.Field)24 Randoms (lib.Randoms)20 Action (common.datastore.action.Action)19 LockedCandidate (core.action.candidate.LockedCandidate)18 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)18 ArgumentsSource (org.junit.jupiter.params.provider.ArgumentsSource)16 Log (_usecase.Log)13 MinoFactory (core.mino.MinoFactory)12 MinoShifter (core.mino.MinoShifter)12 MinoRotation (core.srs.MinoRotation)10 LockedReachable (core.action.reachable.LockedReachable)9 List (java.util.List)9 LongPieces (common.datastore.blocks.LongPieces)8 SizedBit (searcher.pack.SizedBit)8 ColumnField (core.column_field.ColumnField)7 Collectors (java.util.stream.Collectors)7 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)7