Gather data

This commit is contained in:
mike
2026-01-09 22:25:15 +01:00
parent 2ec023b49d
commit 183216e753
5 changed files with 75 additions and 73 deletions

View File

@@ -17,7 +17,7 @@ public class ExportFormatTest {
@Test
void testExportFormatFromFilled() {
var swe = new SwedishGenerator();
var grid = SwedishGenerator.makeEmptyGrid();
var grid = Grid.createEmpty();
// Place a '2' (right) at (0,0)
grid.setClue(0, (byte) '2');
@@ -76,7 +76,7 @@ public class ExportFormatTest {
@Test
void testExportFormatEmpty() {
var swe = new SwedishGenerator();
var grid = SwedishGenerator.makeEmptyGrid();
var grid = Grid.createEmpty();
var fillResult = new FillResult(true, new Gridded(grid), new HashMap<>(), null);
var puzzleResult = new PuzzleResult(swe, null, null, fillResult);

View File

@@ -24,7 +24,7 @@ public class MainTest {
@Test
void testExtractSlots() {
var generator = new SwedishGenerator();
var grid = makeEmptyGrid();
var grid = Grid.createEmpty();
// Set up digits on the grid to create slots.
// '2' (right) at (0,0) -> slot at (0,1), (0,2)
@@ -60,7 +60,7 @@ public class MainTest {
@Test
void testForEachSlot() {
var generator = new SwedishGenerator();
var grid = makeEmptyGrid();
var grid = Grid.createEmpty();
grid.setClue(0, (byte) '2'); // right
var count = new AtomicInteger(0);
@@ -82,7 +82,7 @@ public class MainTest {
}
@Test
public void testGridBasics() {
var grid = makeEmptyGrid();
var grid = Grid.createEmpty();
// Test set/get
grid.setCharAt(0, 0, 'A');
@@ -115,7 +115,7 @@ public class MainTest {
@Test
public void testGridDeepCopy() {
var grid = makeEmptyGrid();
var grid = Grid.createEmpty();
grid.setCharAt(0, 0, 'A');
grid.setCharAt(0, 1, 'B');
grid.setCharAt(1, 0, 'C');
@@ -131,7 +131,7 @@ public class MainTest {
@Test
public void testMini() {
var grid = makeEmptyGrid();
var grid = Grid.createEmpty();
grid.setCharAt(1, 1, '1');
Assertions.assertTrue(grid.isDigitAt(1, 1));
}
@@ -148,7 +148,7 @@ public class MainTest {
opts.tries = 1;
opts.verbose = false;
var dict = loadWords(opts.wordsPath);
var dict = Dict.loadDict(opts.wordsPath);
// Act
PuzzleResult res = null;

View File

@@ -69,7 +69,7 @@ public class SwedishGeneratorTest {
@Test
void testGrid() {
var grid = SwedishGenerator.makeEmptyGrid();
var grid = Grid.createEmpty();
grid.setCharAt(0, 0, 'A');
grid.setCharAt(0, 1, '1');
@@ -191,7 +191,7 @@ public class SwedishGeneratorTest {
@Test
void testForEachSlotAndExtractSlots() {
var gen = new SwedishGenerator();
var grid = SwedishGenerator.makeEmptyGrid();
var grid = Grid.createEmpty();
// 3x3 grid (Config.PUZZLE_ROWS/COLS are 3 in test env)
// Set '2' (right) at 0,0
grid.setClue(0, (byte) '2');
@@ -219,7 +219,7 @@ public class SwedishGeneratorTest {
@Test
void testMaskFitnessBasic() {
var gen = new SwedishGenerator();
var grid = SwedishGenerator.makeEmptyGrid();
var grid = Grid.createEmpty();
var lenCounts = new int[12];
lenCounts[2] = 10;
lenCounts[8] = 10; // In case MAX_WORD_LENGTH is 8
@@ -257,7 +257,7 @@ public class SwedishGeneratorTest {
@Test
void testPlaceWord() {
var grid = SwedishGenerator.makeEmptyGrid();
var grid = Grid.createEmpty();
// Slot at (0,0) length 3, horizontal (right)
// key = (r << 8) | (c << 4) | d. Here we just need a valid slot for placeWord.
// r(i) and c(i) are used by placeWord.
@@ -286,7 +286,7 @@ public class SwedishGeneratorTest {
assertEquals('C', grid.byteAt(0, 2));
// 4. Partial placement then conflict (rollback)
grid = SwedishGenerator.makeEmptyGrid();
grid = Grid.createEmpty();
grid.setCharAt(0, 2, 'X'); // Conflict at the end
assertFalse(SwedishGenerator.placeWord(grid, s, w1, undoBuffer, 3));
// Verify grid is still empty (except for 'X')
@@ -297,7 +297,7 @@ public class SwedishGeneratorTest {
@Test
void testBacktrackingHelpers() {
var grid = SwedishGenerator.makeEmptyGrid();
var grid = Grid.createEmpty();
// Slot at 0,1 length 2
var packedPos = ((long) Grid.offset(0, 1)) | (((long) Grid.offset(0, 2)) << 7);
var s = Slot.from((0 << 8) | (1 << 4) | 2, packedPos, 2);
@@ -310,7 +310,7 @@ public class SwedishGeneratorTest {
assertEquals('Z', grid.byteAt(0, 2));
assertEquals(0b11L, undoBuffer[0]);
SwedishGenerator.undoPlace(grid, s, undoBuffer[0]);
s.undoPlace(grid, undoBuffer[0]);
assertEquals(SwedishGenerator.DASH, grid.byteAt(0, 1));
assertEquals(SwedishGenerator.DASH, grid.byteAt(0, 2));
}