introduce bitloops
This commit is contained in:
@@ -14,7 +14,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static puzzle.SwedishGenerator.*;
|
||||
import static puzzle.SwedishGenerator.DASH;
|
||||
|
||||
public class MainTest {
|
||||
|
||||
@@ -107,13 +106,13 @@ public class MainTest {
|
||||
Assertions.assertEquals(LETTER_A, grid.letter32At(OFF_0_0));
|
||||
Assertions.assertEquals(CLUE_UP, clues.digitAt(OFF_1_2));
|
||||
Assertions.assertEquals(LETTER_Z, grid.letter32At(OFF_2_3));
|
||||
Assertions.assertEquals(DASH, grid.letter32At(OFF_1_1));
|
||||
Assertions.assertFalse(grid.lisLetterAtLo(OFF_1_1));
|
||||
|
||||
// Verify letter mask
|
||||
Assertions.assertTrue((grid.lo & (1L << OFF_0_0)) != 0);
|
||||
Assertions.assertTrue((grid.lo & (1L << OFF_2_3)) != 0);
|
||||
Assertions.assertTrue((grid.lo & (1L << OFF_1_2)) != 0); // Clue also in lo
|
||||
Assertions.assertTrue((grid.lo & (1L << OFF_1_1)) == 0); // Empty letter cell
|
||||
assertEquals(0, (grid.lo & (1L << OFF_1_1))); // Empty letter cell
|
||||
|
||||
// Test isLetterAt
|
||||
Assertions.assertTrue(clues.notClue(OFF_0_0));
|
||||
|
||||
@@ -100,7 +100,7 @@ public class SwedishGeneratorTest {
|
||||
|
||||
@Test
|
||||
void testPatternForSlotAllDashes() {
|
||||
var grid = createEmpty();
|
||||
var grid = createEmpty();
|
||||
var slot = Slot.from(1 << Slot.BIT_FOR_DIR | (CLUE_RIGHT), 7L, 0L);
|
||||
var pattern = patternForSlot(grid, slot);
|
||||
|
||||
@@ -360,8 +360,8 @@ public class SwedishGeneratorTest {
|
||||
grid.setLetter(OFF_0_2, LETTER_X); // Conflict at the end
|
||||
assertFalse(placeWord(grid, s, w1, undoBuffer, 3));
|
||||
// Verify grid is still empty (except for 'X')
|
||||
assertEquals(DASH, grid.letter32At(OFF_0_0));
|
||||
assertEquals(DASH, grid.letter32At(OFF_0_1));
|
||||
assertFalse(grid.lisLetterAtLo(OFF_0_0));
|
||||
assertFalse(grid.lisLetterAtLo(OFF_0_1));
|
||||
assertEquals(LETTER_X, grid.letter32At(OFF_0_2));
|
||||
}
|
||||
|
||||
@@ -382,8 +382,8 @@ public class SwedishGeneratorTest {
|
||||
assertEquals(lo, undoBuffer[0]);
|
||||
|
||||
grid.undoPlace(undoBuffer[0], undoBuffer[1]);
|
||||
assertEquals(DASH, grid.letter32At(OFF_0_1));
|
||||
assertEquals(DASH, grid.letter32At(OFF_0_2));
|
||||
assertFalse(grid.lisLetterAtLo(OFF_0_1));
|
||||
assertFalse(grid.lisLetterAtLo(OFF_0_2));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user