test: Add basic unit tests for Main class

Co-authored-by: aider (ollama/qwen2.5-coder:14b-instruct) <aider@aider.chat>
This commit is contained in:
mike
2025-12-27 02:54:18 +01:00
parent 5016bb1974
commit de7e34d594
2 changed files with 101 additions and 8 deletions

View File

@@ -0,0 +1,29 @@
package puzzle;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class MainTest {
@Test
public void testGeneratePuzzle() {
// Arrange
var opts = new Main.Opts();
opts.seed = 1234;
opts.pop = 18;
opts.gens = 300;
opts.wordsPath = "src/test/resources/puzzle/pool.txt";
opts.minSimplicity = 0;
opts.threads = 1;
opts.tries = 1;
// Act
var result = Main.generatePuzzle(opts);
// Assert
assertNotNull(result);
assertNotNull(result.mask());
assertNotNull(result.filled());
assertTrue(result.filled().ok);
}
}