@tscircuit/schematic-trace-solver 0.0.162 → 0.0.163

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.
@@ -0,0 +1,21 @@
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-isolated-rs485-isow7841.input.json"
6
+
7
+ test("repro isolated RS-485 ISOW7841 schematic traces", () => {
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.solved).toBe(true)
16
+ expect(solver.schematicTraceLinesSolver?.solvedTracePaths).toHaveLength(50)
17
+ expect(solver.schematicTraceLinesSolver?.failedConnectionPairs).toHaveLength(
18
+ 0,
19
+ )
20
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
21
+ })
@@ -0,0 +1,73 @@
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 inputProblem: InputProblem = {
7
+ chips: [
8
+ {
9
+ chipId: "R8",
10
+ center: { x: -7, y: -19 },
11
+ width: 0.6,
12
+ height: 0.65,
13
+ pins: [
14
+ { pinId: "R8.pin1", x: -7.3, y: -19, _facingDirection: "x-" },
15
+ { pinId: "R8.pin2", x: -6.7, y: -19, _facingDirection: "x+" },
16
+ ],
17
+ },
18
+ {
19
+ chipId: "R7",
20
+ center: { x: -5, y: -19 },
21
+ width: 0.6,
22
+ height: 0.65,
23
+ pins: [
24
+ { pinId: "R7.pin1", x: -5.3, y: -19, _facingDirection: "x-" },
25
+ { pinId: "R7.pin2", x: -4.7, y: -19, _facingDirection: "x+" },
26
+ ],
27
+ },
28
+ ],
29
+ directConnections: [],
30
+ netConnections: [
31
+ {
32
+ netId: "V3V3",
33
+ netLabelText: "V3V3",
34
+ pinIds: ["R8.pin2", "R7.pin2"],
35
+ netLabelWidth: 0.48,
36
+ netLabelHeight: 0.42,
37
+ },
38
+ {
39
+ netId: "U1_IO22",
40
+ netLabelText: "U1_IO22",
41
+ pinIds: ["R8.pin1"],
42
+ netLabelWidth: 0.84,
43
+ netLabelHeight: 0.42,
44
+ },
45
+ {
46
+ netId: "U1_IO21",
47
+ netLabelText: "U1_IO21",
48
+ pinIds: ["R7.pin1"],
49
+ netLabelWidth: 1,
50
+ netLabelHeight: 0.42,
51
+ },
52
+ ],
53
+ availableNetLabelOrientations: {
54
+ V3V3: ["y+"],
55
+ U1_IO22: ["x-"],
56
+ U1_IO21: ["x-"],
57
+ },
58
+ maxMspPairDistance: 2.4,
59
+ }
60
+
61
+ test("repro: V3V3 net-label branch does not start at the R8 edge", () => {
62
+ const solver = new SchematicTracePipelineSolver(inputProblem)
63
+
64
+ solver.solve()
65
+
66
+ expect(
67
+ solver.netLabelNetLabelCollisionSolver!.getOutput().netLabelPlacements,
68
+ ).not.toHaveLength(0)
69
+ expect(
70
+ solver.inlineNetLabelSolver!.getOutput().inlineNetLabelPlacements,
71
+ ).toHaveLength(0)
72
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
73
+ })