use of lib.Randoms in project solution-finder by knewjade.
the class LongPiecesTest method createRandomSize22.
@Test
void createRandomSize22() throws Exception {
Randoms randoms = new Randoms();
for (int count = 0; count < 10000; count++) {
List<Piece> blocks = randoms.blocks(22);
Pieces pieces = new LongPieces(blocks);
assertThat(pieces.blockStream()).containsExactlyElementsOf(blocks);
assertThat(pieces.getPieces()).isEqualTo(blocks);
}
}
use of lib.Randoms in project solution-finder by knewjade.
the class LongPiecesTest method equalToReadOnlyPieces.
@Test
void equalToReadOnlyPieces() throws Exception {
Randoms randoms = new Randoms();
for (int count = 0; count < 10000; count++) {
int size = randoms.nextInt(1, 22);
List<Piece> pieces = randoms.blocks(size);
LongPieces longPieces = new LongPieces(pieces);
Pieces readOnlyListPieces = new ReadOnlyListPieces(pieces);
assertThat(longPieces.equals(readOnlyListPieces)).as(longPieces.getPieces().toString()).isTrue();
}
}
use of lib.Randoms in project solution-finder by knewjade.
the class LongPiecesTest method createRandom.
@Test
void createRandom() throws Exception {
Randoms randoms = new Randoms();
for (int count = 0; count < 10000; count++) {
ArrayList<Piece> blocks = new ArrayList<>(randoms.blocks(1));
Pieces pieces = new LongPieces(blocks);
for (int addCount = 0; addCount < 3; addCount++) {
List<Piece> newPieces = randoms.blocks(randoms.nextInt(0, 7));
blocks.addAll(newPieces);
pieces = pieces.addAndReturnNew(newPieces);
}
assertThat(pieces.getPieces()).isEqualTo(blocks);
}
}
use of lib.Randoms in project solution-finder by knewjade.
the class ReadOnlyListPiecesTest method createRandom.
@Test
void createRandom() throws Exception {
Randoms randoms = new Randoms();
for (int count = 0; count < 10000; count++) {
int size = randoms.nextInt(1, 22);
List<Piece> blocks = randoms.blocks(size);
Pieces pieces = new ReadOnlyListPieces(blocks);
assertThat(pieces.getPieces()).isEqualTo(blocks);
}
}
use of lib.Randoms in project solution-finder by knewjade.
the class ReadOnlyListPiecesTest method createRandomStream.
@Test
void createRandomStream() throws Exception {
Randoms randoms = new Randoms();
for (int count = 0; count < 10000; count++) {
int size = randoms.nextInt(1, 22);
List<Piece> blocks = randoms.blocks(size);
Pieces pieces = new ReadOnlyListPieces(blocks);
assertThat(pieces.getPieces()).isEqualTo(blocks);
}
}
Aggregations