use of core.mino.MinoFactory in project solution-finder by knewjade.
the class TetfuTest method decode3.
@Test
void decode3() throws Exception {
// empty
String value = "vhAAgH";
MinoFactory factory = new MinoFactory();
ColorConverter converter = new ColorConverter();
Tetfu tetfu = new Tetfu(factory, converter);
List<TetfuPage> pages = tetfu.decode(value);
assertThat(pages).hasSize(1);
assertThat(pages.get(0)).returns(ColorType.Empty, TetfuPage::getColorType).returns(Rotate.Reverse, TetfuPage::getRotate).returns(0, TetfuPage::getX).returns(22, TetfuPage::getY).returns("", TetfuPage::getComment);
assertField(ColoredFieldFactory.createColoredField(""), pages.get(0).getField());
}
use of core.mino.MinoFactory in project solution-finder by knewjade.
the class TetfuTest method encode3.
@Test
void encode3() throws Exception {
List<TetfuElement> elements = Arrays.asList(new TetfuElement(ColorType.I, Rotate.Reverse, 5, 0, "a"), new TetfuElement(ColorType.S, Rotate.Reverse, 5, 2, "b"), new TetfuElement(ColorType.J, Rotate.Left, 9, 1, "c"), new TetfuElement(ColorType.O, Rotate.Right, 0, 1, "d"), new TetfuElement(ColorType.Z, Rotate.Left, 3, 1, "e"), new TetfuElement(ColorType.L, Rotate.Right, 0, 3, "日本語"), new TetfuElement(ColorType.T, Rotate.Reverse, 7, 1));
MinoFactory factory = new MinoFactory();
ColorConverter converter = new ColorConverter();
Tetfu tetfu = new Tetfu(factory, converter);
String encode = tetfu.encode(elements);
assertThat(encode).isEqualTo("vhGBQYBABBAAAnmQBACBAAA+tQBADBAAALpQBAEBAA?AcqQBAFBAAAKfQSAlfrHBFwDfE2Cx2Bl/PwB53AAAlsQAA");
}
use of core.mino.MinoFactory in project solution-finder by knewjade.
the class TetfuTest method decode6.
@Test
void decode6() throws Exception {
String value = "VhRpHeRpNeAgHvhIAAAAAAAAAAAAAAAAAAAAAAAAAA?A";
MinoFactory factory = new MinoFactory();
ColorConverter converter = new ColorConverter();
Tetfu tetfu = new Tetfu(factory, converter);
List<TetfuPage> pages = tetfu.decode(value);
assertThat(pages).hasSize(10);
for (int index = 0; index < 10; index++) {
assertThat(pages.get(index)).returns(ColorType.Empty, TetfuPage::getColorType).returns("", TetfuPage::getComment);
}
assertField(ColoredFieldFactory.createColoredField("" + "____OO____" + "____OO____"), pages.get(9).getField());
}
use of core.mino.MinoFactory in project solution-finder by knewjade.
the class TetfuTest method decode1.
@Test
void decode1() throws Exception {
String value = "bhzhPexAN";
MinoFactory factory = new MinoFactory();
ColorConverter converter = new ColorConverter();
Tetfu tetfu = new Tetfu(factory, converter);
List<TetfuPage> pages = tetfu.decode(value);
assertThat(pages).hasSize(1);
assertThat(pages.get(0)).returns(ColorType.I, TetfuPage::getColorType).returns(Rotate.Spawn, TetfuPage::getRotate).returns(5, TetfuPage::getX).returns(0, TetfuPage::getY).returns("", TetfuPage::getComment);
assertField(ColoredFieldFactory.createColoredField("IIII______"), pages.get(0).getField());
}
use of core.mino.MinoFactory in project solution-finder by knewjade.
the class TetfuTest method decode7.
@Test
void decode7() throws Exception {
String value = "+gH8AeI8BeH8AeI8KeAgHvhBpoBAAA";
MinoFactory factory = new MinoFactory();
ColorConverter converter = new ColorConverter();
Tetfu tetfu = new Tetfu(factory, converter);
List<TetfuPage> pages = tetfu.decode(value);
assertThat(pages).hasSize(3);
assertThat(pages.get(0)).returns(ColorType.Empty, TetfuPage::getColorType);
assertThat(pages.get(1)).returns(ColorType.I, TetfuPage::getColorType);
assertThat(pages.get(2)).returns(ColorType.Empty, TetfuPage::getColorType);
assertField(ColoredFieldFactory.createColoredField("" + "_XXXXXXXXI" + "_XXXXXXXXI"), pages.get(2).getField());
}
Aggregations