@tscircuit/schematic-trace-solver 0.0.130 → 0.0.132
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 +6 -0
- package/dist/index.js +217 -13
- package/lib/solvers/AvailableNetOrientationSolver/AvailableNetOrientationSolver.ts +290 -12
- package/lib/solvers/SameNetJunctionAlignmentSolver/alignSameNetJunctions.ts +9 -0
- package/package.json +1 -1
- package/tests/bug-reports/bug-report-20260721T221026Z/__snapshots__/bug-report-20260721T221026Z.snap.svg +4 -4
- package/tests/bug-reports/bug-report-20260811T075142Z/__snapshots__/bug-report-20260811T075142Z.snap.svg +32 -32
- package/tests/bug-reports/bug-report-20260811T075142Z/bug-report-20260811T075142Z.test.ts +119 -0
- package/tests/repros/__snapshots__/repro-board-589-regulator-section.snap.svg +69 -0
- package/tests/repros/__snapshots__/repro-usb-power-vbus-label-detour.snap.svg +467 -0
- package/tests/repros/assets/repro-board-589-regulator-section.input.json +270 -0
- package/tests/repros/assets/repro-usb-power-vbus-label-detour.input.json +2382 -0
- package/tests/repros/repro-board-589-regulator-section.test.ts +33 -0
- package/tests/repros/repro-usb-power-vbus-label-detour.test.ts +16 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
3
|
+
import { tracePathContainsPoint } from "lib/solvers/RailNetLabelCornerPlacementSolver/geometry"
|
|
4
|
+
import type { InputProblem } from "lib/types/InputProblem"
|
|
5
|
+
import "tests/fixtures/matcher"
|
|
6
|
+
import inputProblemJson from "./assets/repro-board-589-regulator-section.input.json"
|
|
7
|
+
|
|
8
|
+
const EXPECTED_ALIGNED_JUNCTION_COUNT = 1
|
|
9
|
+
|
|
10
|
+
test("board 589 regulator section trace routing", () => {
|
|
11
|
+
const inputProblem: InputProblem = JSON.parse(
|
|
12
|
+
JSON.stringify(inputProblemJson),
|
|
13
|
+
)
|
|
14
|
+
const solver = new SchematicTracePipelineSolver(inputProblem)
|
|
15
|
+
|
|
16
|
+
solver.solve()
|
|
17
|
+
|
|
18
|
+
const junctionOutput = solver.sameNetJunctionAlignmentSolver!.getOutput()
|
|
19
|
+
const v3V3Label = junctionOutput.netLabelPlacements.find(
|
|
20
|
+
(label) => label.netId === "V3_3",
|
|
21
|
+
)!
|
|
22
|
+
const labeledTrace = junctionOutput.traces.find((trace) =>
|
|
23
|
+
v3V3Label.mspConnectionPairIds.includes(trace.mspPairId),
|
|
24
|
+
)!
|
|
25
|
+
|
|
26
|
+
expect(
|
|
27
|
+
solver.sameNetJunctionAlignmentSolver!.stats.alignedJunctionCount,
|
|
28
|
+
).toBe(EXPECTED_ALIGNED_JUNCTION_COUNT)
|
|
29
|
+
expect(
|
|
30
|
+
tracePathContainsPoint(labeledTrace.tracePath, v3V3Label.anchorPoint),
|
|
31
|
+
).toBe(true)
|
|
32
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
33
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
import inputProblemJson from "./assets/repro-usb-power-vbus-label-detour.input.json"
|
|
6
|
+
|
|
7
|
+
test("reproduces the usb power vbus label detour", () => {
|
|
8
|
+
const inputProblem: InputProblem = JSON.parse(
|
|
9
|
+
JSON.stringify(inputProblemJson),
|
|
10
|
+
)
|
|
11
|
+
const solver = new SchematicTracePipelineSolver(inputProblem)
|
|
12
|
+
|
|
13
|
+
solver.solve()
|
|
14
|
+
|
|
15
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
16
|
+
})
|