import { describe, expect, it } from "vitest"; import { CLASSIC_SAMPLE, SAMPLE_CATALOG, SAMPLE_PUZZLES, } from "../../src/data/samples"; import { GENERATOR_VARIANTS, solveExact, solveLogically, } from "../../src/solver"; describe("bundled original samples", () => { it.each(SAMPLE_PUZZLES)("ships $title as a unique puzzle", (puzzle) => { const result = solveExact(puzzle, { maxSolutions: 2 }); expect(result.count).toBe(1); expect(result.truncated).toBe(false); }); it("solves the generated classic with the supported logical techniques", () => { expect(solveLogically(CLASSIC_SAMPLE).status).toBe("solved"); }); it("provides a named example for every advertised generator variant", () => { expect(new Set(SAMPLE_CATALOG.map(({ id }) => id)).size).toBe( SAMPLE_CATALOG.length, ); for (const { id } of GENERATOR_VARIANTS) { expect(SAMPLE_CATALOG.some((entry) => entry.id === id)).toBe(true); } }); it("also demonstrates every supported global chess/adjacency rule", () => { const constraintTypes = new Set( SAMPLE_PUZZLES.flatMap((puzzle) => (puzzle.constraints ?? []).map(({ type }) => type), ), ); expect(constraintTypes).toEqual( new Set([ "diagonal", "anti-knight", "anti-king", "non-consecutive", "killer-cage", "thermo", "arrow", "kropki", "xv", "inequality", "renban", "palindrome", ]), ); }); });