use of searcher.pack.mino_field.RecursiveMinoField in project solution-finder by knewjade.
the class MinoFieldComparatorTest method compareMinoFieldDiffMino.
@Test
void compareMinoFieldDiffMino() {
Randoms randoms = new Randoms();
List<SeparableMino> minos = separableMinos.getMinos();
MinoFieldComparator comparator = new MinoFieldComparator();
for (int count = 0; count < 100000; count++) {
int index1 = randoms.nextInt(0, minos.size());
SeparableMino mino1 = minos.get(index1);
RecursiveMinoField recursiveMinoField1 = new RecursiveMinoField(mino1, ColumnFieldFactory.createField(), separableMinos);
int index2 = randoms.nextInt(0, minos.size() - 1);
if (index1 == index2)
index2 += 1;
SeparableMino mino2 = minos.get(index2);
RecursiveMinoField recursiveMinoField2 = new RecursiveMinoField(mino2, ColumnFieldFactory.createField(), separableMinos);
// assert is not 0 & sign reversed
assertThat(comparator.compare(recursiveMinoField1, recursiveMinoField2) * comparator.compare(recursiveMinoField2, recursiveMinoField1)).isLessThan(0);
}
}
use of searcher.pack.mino_field.RecursiveMinoField in project solution-finder by knewjade.
the class MinoFieldComparatorTest method compareMinoFieldDiffSize.
@Test
void compareMinoFieldDiffSize() {
Randoms randoms = new Randoms();
List<SeparableMino> minos = separableMinos.getMinos();
int index = randoms.nextInt(0, minos.size() - 1);
SeparableMino mino = minos.get(index);
RecursiveMinoField recursiveMinoField1 = new RecursiveMinoField(mino, ColumnFieldFactory.createField(), separableMinos);
RecursiveMinoField recursiveMinoField2 = new RecursiveMinoField(mino, ColumnFieldFactory.createField(), separableMinos);
recursiveMinoField2 = new RecursiveMinoField(mino, recursiveMinoField2, ColumnFieldFactory.createField(), separableMinos);
// assert is not 0 & sign reversed
MinoFieldComparator comparator = new MinoFieldComparator();
assertThat(comparator.compare(recursiveMinoField1, recursiveMinoField2) * comparator.compare(recursiveMinoField2, recursiveMinoField1)).isLessThan(0);
}
Aggregations