Gather data

This commit is contained in:
mike
2026-01-04 03:50:34 +01:00
parent 6bf83aa564
commit f031591105
5 changed files with 21 additions and 77 deletions

View File

@@ -0,0 +1,32 @@
package puzzle;
//import org.junit.jupiter.api.Test;
//import static org.junit.jupiter.api.Assertions.*;
public class MainTest {
static void main() {
new MainTest().testGeneratePuzzle();
}
// @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 = new Main().generatePuzzle(opts);
// Assert
/* assertNotNull(result);
assertNotNull(result.mask());
assertNotNull(result.filled());
assertTrue(result.filled().ok);*/
}
}

View File

@@ -0,0 +1,26 @@
package puzzle;
import puzzle.ThemePoolBuilderLength.Lexicon;
import java.nio.file.*;
import java.util.*;
public class TestSort {
public static void main(String[] args) throws Exception {
Lexicon lex = new Lexicon(
Arrays.asList("A", "B", "C"),
new HashMap<>(),
new int[]{10, 30, 20},
new BitSet[9]
);
BitSet bs = new BitSet();
bs.set(0); bs.set(1); bs.set(2);
Path p = Paths.get("test_pool.txt");
ThemePoolBuilderLength.writeWordList(p, lex, bs);
List<String> lines = Files.readAllLines(p);
System.out.println("Sorted words: " + lines);
if (lines.get(0).equals("B") && lines.get(1).equals("C") && lines.get(2).equals("A")) {
System.out.println("SUCCESS");
} else {
System.out.println("FAILURE");
System.exit(1);
}
}
}