Gather data

This commit is contained in:
mike
2026-01-09 21:24:52 +01:00
parent dc331fc96b
commit 95891d9efe
10 changed files with 572 additions and 584 deletions

View File

@@ -3,6 +3,7 @@ package puzzle;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import puzzle.SwedishGenerator.*;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import static org.junit.jupiter.api.Assertions.*;
@@ -103,7 +104,7 @@ public class SwedishGeneratorTest {
@Test
void testLemmaAndDict() {
var l1 = new Lemma("APPLE", 5, "A fruit");
Assertions.assertArrayEquals("APPLE".getBytes(java.nio.charset.StandardCharsets.US_ASCII), l1.word());
Assertions.assertArrayEquals("APPLE".getBytes(StandardCharsets.US_ASCII), l1.word());
assertEquals(5, l1.word().length);
assertEquals(5, l1.simpel());
assertEquals((byte) 'A', l1.byteAt(0));
@@ -116,7 +117,7 @@ public class SwedishGeneratorTest {
var entry3 = dict.index()[3];
assertEquals(1, entry3.words().size());
Assertions.assertArrayEquals("AXE".getBytes(java.nio.charset.StandardCharsets.US_ASCII), entry3.words().getFirst().word());
Assertions.assertArrayEquals("AXE".getBytes(StandardCharsets.US_ASCII), entry3.words().getFirst().word());
// Check pos indexing
// AXE: A at 0, X at 1, E at 2
@@ -181,7 +182,7 @@ public class SwedishGeneratorTest {
// Pattern "APP--" for length 5
var context = new Context();
context.setPatter(new byte[]{ 'A', 'P', 'P', SwedishGenerator.DASH, SwedishGenerator.DASH });
var info = gen.candidateInfoForPattern(context, dict.index()[5], 5);
var info = SwedishGenerator.candidateInfoForPattern(context, dict.index()[5], 5);
assertEquals(2, info.count());
assertNotNull(info.indices());