@tscircuit/schematic-trace-solver 0.0.193 → 0.0.194
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.js +3 -1
- package/lib/solvers/UnroutedTraceRecoverySolver/UnroutedTraceRecoverySolver.ts +4 -1
- package/package.json +1 -1
- package/site/SchematicTracePipelineSolver/repro-core-vertical-passive-ground-label-overlap.page.tsx +4 -0
- package/tests/bug-reports/bug-report-20260724T175257Z/__snapshots__/bug-report-20260724T175257Z.snap.svg +35 -35
- package/tests/repros/__snapshots__/board-1273-trace-overlap-cycle.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-core-vertical-passive-ground-label-overlap.snap.svg +135 -0
- package/tests/repros/__snapshots__/repro-manual-placement-detour.snap.svg +249 -0
- package/tests/repros/assets/repro-core-vertical-passive-ground-label-overlap.input.json +353 -0
- package/tests/repros/repro-core-vertical-passive-ground-label-overlap.test.ts +39 -0
- package/tests/repros/repro-manual-placement-detour.input.json +853 -0
- package/tests/repros/repro-manual-placement-detour.test.ts +39 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
3
|
+
import { findFirstCollision } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/collisions"
|
|
4
|
+
import { getObstacleRects } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/rect"
|
|
5
|
+
import type { InputProblem } from "lib/types/InputProblem"
|
|
6
|
+
import "tests/fixtures/matcher"
|
|
7
|
+
import inputJson from "./repro-manual-placement-detour.input.json"
|
|
8
|
+
|
|
9
|
+
// Captured from core/tests/components/primitive-components/schematic-section-manual-placement-5.test.tsx.
|
|
10
|
+
// R2 pin1 and C3 pin1 face upward, with C3 obstructing the initial U-shaped route.
|
|
11
|
+
test("routes R2 to C3 locally in manually placed schematic sections", async () => {
|
|
12
|
+
const inputProblem: InputProblem = JSON.parse(JSON.stringify(inputJson))
|
|
13
|
+
const solver = new SchematicTracePipelineSolver(inputProblem)
|
|
14
|
+
solver.solve()
|
|
15
|
+
|
|
16
|
+
const trace = solver
|
|
17
|
+
.netLabelToTraceSolver!.getOutput()
|
|
18
|
+
.traces.find(
|
|
19
|
+
(trace) =>
|
|
20
|
+
trace.pinIds.includes("schematic_port_31") &&
|
|
21
|
+
trace.pinIds.includes("schematic_port_29"),
|
|
22
|
+
)!
|
|
23
|
+
let routeLength = 0
|
|
24
|
+
for (let pointIndex = 1; pointIndex < trace.tracePath.length; pointIndex++) {
|
|
25
|
+
const previousPoint = trace.tracePath[pointIndex - 1]!
|
|
26
|
+
const point = trace.tracePath[pointIndex]!
|
|
27
|
+
routeLength +=
|
|
28
|
+
Math.abs(point.x - previousPoint.x) + Math.abs(point.y - previousPoint.y)
|
|
29
|
+
}
|
|
30
|
+
expect(solver.solved).toBe(true)
|
|
31
|
+
expect(
|
|
32
|
+
findFirstCollision(trace.tracePath, getObstacleRects(inputProblem)),
|
|
33
|
+
).toBeNull()
|
|
34
|
+
expect(routeLength).toBeCloseTo(3.06)
|
|
35
|
+
expect(Math.min(...trace.tracePath.map((point) => point.x))).toBeGreaterThan(
|
|
36
|
+
-3.5,
|
|
37
|
+
)
|
|
38
|
+
await expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
39
|
+
})
|