@tscircuit/schematic-trace-solver 0.0.140 → 0.0.141
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -0
- package/dist/index.js +43 -4
- package/lib/solvers/TraceOverlapShiftSolver/TraceOverlapShiftSolver.ts +60 -4
- package/package.json +1 -1
- package/tests/repros/__snapshots__/board-1273-trace-overlap-cycle.snap.svg +542 -0
- package/tests/repros/assets/board-1273-trace-overlap-cycle.input.json +3519 -0
- package/tests/repros/board-1273-trace-overlap-cycle.test.ts +30 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
3
|
+
import type { InputProblem } from "lib/types/InputProblem"
|
|
4
|
+
import "tests/fixtures/matcher"
|
|
5
|
+
|
|
6
|
+
const MAX_OVERLAP_ITERATIONS_FOR_REPRO = 100
|
|
7
|
+
|
|
8
|
+
test("board 1273 solves within the trace overlap iteration limit", async () => {
|
|
9
|
+
const inputProblem = JSON.parse(
|
|
10
|
+
await Bun.file(
|
|
11
|
+
new URL(
|
|
12
|
+
"./assets/board-1273-trace-overlap-cycle.input.json",
|
|
13
|
+
import.meta.url,
|
|
14
|
+
),
|
|
15
|
+
).text(),
|
|
16
|
+
) as InputProblem
|
|
17
|
+
const solver = new SchematicTracePipelineSolver(inputProblem)
|
|
18
|
+
|
|
19
|
+
solver.solveUntilPhase("traceOverlapShiftSolver")
|
|
20
|
+
solver.step()
|
|
21
|
+
solver.traceOverlapShiftSolver!.MAX_ITERATIONS =
|
|
22
|
+
MAX_OVERLAP_ITERATIONS_FOR_REPRO
|
|
23
|
+
solver.solve()
|
|
24
|
+
|
|
25
|
+
expect(solver.solved).toBe(true)
|
|
26
|
+
expect(solver.failed).toBe(false)
|
|
27
|
+
expect(solver.traceOverlapShiftSolver?.iterations).toBe(21)
|
|
28
|
+
expect(solver.postLabelTraceOverlapShiftSolver?.iterations).toBe(1)
|
|
29
|
+
await expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
30
|
+
})
|