use of common.comparator.PiecesNumberComparator in project solution-finder by knewjade.
the class ForwardOrderLookUpTest method parseOverBlocks.
@Test
void parseOverBlocks() throws Exception {
List<Piece> pieceList = Arrays.asList(Piece.I, Piece.T, Piece.Z, Piece.O, Piece.I, Piece.L);
int toDepth = pieceList.size() - 1;
PiecesNumberComparator comparator = new PiecesNumberComparator();
List<LongPieces> forward1 = OrderLookup.forwardBlocks(pieceList, toDepth).stream().map(StackOrder::toList).map(LongPieces::new).sorted(comparator).collect(Collectors.toList());
ForwardOrderLookUp lookUp = new ForwardOrderLookUp(toDepth, pieceList.size());
List<LongPieces> forward2 = lookUp.parse(pieceList).map(blockStream -> blockStream.collect(Collectors.toList())).map(LongPieces::new).sorted(comparator).collect(Collectors.toList());
assertThat(forward2).isEqualTo(forward1);
}
Aggregations