@tscircuit/schematic-trace-solver 0.0.39 → 0.0.41

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,241 @@
1
+ import { test, expect } from "bun:test"
2
+ import type { InputProblem } from "lib/index"
3
+ import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
4
+ import "tests/fixtures/matcher"
5
+
6
+ const inputProblem: InputProblem = {
7
+ chips: [
8
+ {
9
+ chipId: "schematic_component_0",
10
+ center: {
11
+ x: 0,
12
+ y: 0,
13
+ },
14
+ width: 1.8,
15
+ height: 2,
16
+ pins: [
17
+ {
18
+ pinId: "U1.1",
19
+ x: -0.2,
20
+ y: 1.4,
21
+ },
22
+ {
23
+ pinId: "U1.2",
24
+ x: -1.3,
25
+ y: 0.09999999999999998,
26
+ },
27
+ {
28
+ pinId: "U1.3",
29
+ x: -1.3,
30
+ y: -0.10000000000000009,
31
+ },
32
+ {
33
+ pinId: "U1.4",
34
+ x: -1.3,
35
+ y: -0.30000000000000004,
36
+ },
37
+ {
38
+ pinId: "U1.5",
39
+ x: -1.3,
40
+ y: -0.5,
41
+ },
42
+ {
43
+ pinId: "U1.7",
44
+ x: 0,
45
+ y: -1.4,
46
+ },
47
+ {
48
+ pinId: "U1.8",
49
+ x: -1.3,
50
+ y: 0.5,
51
+ },
52
+ {
53
+ pinId: "U1.10",
54
+ x: 1.3,
55
+ y: -0.5,
56
+ },
57
+ {
58
+ pinId: "U1.11",
59
+ x: 1.3,
60
+ y: -0.3,
61
+ },
62
+ {
63
+ pinId: "U1.12",
64
+ x: 1.3,
65
+ y: -0.09999999999999998,
66
+ },
67
+ {
68
+ pinId: "U1.13",
69
+ x: 1.3,
70
+ y: 0.10000000000000009,
71
+ },
72
+ {
73
+ pinId: "U1.14",
74
+ x: 0.2,
75
+ y: 1.4,
76
+ },
77
+ ],
78
+ },
79
+ {
80
+ chipId: "schematic_component_1",
81
+ center: {
82
+ x: -4,
83
+ y: -0.3,
84
+ },
85
+ width: 0.4,
86
+ height: 1.6,
87
+ pins: [
88
+ {
89
+ pinId: "JP1.1",
90
+ x: -3.4,
91
+ y: -0.8999999999999999,
92
+ },
93
+ {
94
+ pinId: "JP1.2",
95
+ x: -3.4,
96
+ y: -0.7,
97
+ },
98
+ {
99
+ pinId: "JP1.3",
100
+ x: -3.4,
101
+ y: -0.49999999999999994,
102
+ },
103
+ {
104
+ pinId: "JP1.4",
105
+ x: -3.4,
106
+ y: -0.2999999999999999,
107
+ },
108
+ {
109
+ pinId: "JP1.5",
110
+ x: -3.4,
111
+ y: -0.09999999999999992,
112
+ },
113
+ {
114
+ pinId: "JP1.6",
115
+ x: -3.4,
116
+ y: 0.10000000000000003,
117
+ },
118
+ {
119
+ pinId: "JP1.7",
120
+ x: -3.4,
121
+ y: 0.3,
122
+ },
123
+ ],
124
+ },
125
+ {
126
+ chipId: "schematic_component_2",
127
+ center: {
128
+ x: 4,
129
+ y: -0.3,
130
+ },
131
+ width: 0.4,
132
+ height: 1.6,
133
+ pins: [
134
+ {
135
+ pinId: "JP2.1",
136
+ x: 3.4,
137
+ y: -0.8999999999999999,
138
+ },
139
+ {
140
+ pinId: "JP2.2",
141
+ x: 3.4,
142
+ y: -0.7,
143
+ },
144
+ {
145
+ pinId: "JP2.3",
146
+ x: 3.4,
147
+ y: -0.5,
148
+ },
149
+ {
150
+ pinId: "JP2.4",
151
+ x: 3.4,
152
+ y: -0.3000000000000001,
153
+ },
154
+ {
155
+ pinId: "JP2.5",
156
+ x: 3.4,
157
+ y: -0.10000000000000003,
158
+ },
159
+ {
160
+ pinId: "JP2.6",
161
+ x: 3.4,
162
+ y: 0.09999999999999998,
163
+ },
164
+ {
165
+ pinId: "JP2.7",
166
+ x: 3.4,
167
+ y: 0.3,
168
+ },
169
+ ],
170
+ },
171
+ ],
172
+ directConnections: [
173
+ {
174
+ pinIds: ["JP1.1", "U1.7"],
175
+ netId: "pinheader.JP1 > port.pin1 to .U1 > .pin7",
176
+ },
177
+ {
178
+ pinIds: ["JP1.3", "U1.5"],
179
+ netId: "pinheader.JP1 > port.pin3 to .U1 > .pin5",
180
+ },
181
+ {
182
+ pinIds: ["JP1.4", "U1.4"],
183
+ netId: "pinheader.JP1 > port.pin4 to .U1 > .pin4",
184
+ },
185
+ {
186
+ pinIds: ["JP1.5", "U1.3"],
187
+ netId: "pinheader.JP1 > port.pin5 to .U1 > .pin3",
188
+ },
189
+ {
190
+ pinIds: ["JP1.6", "U1.2"],
191
+ netId: "pinheader.JP1 > port.pin6 to .U1 > .pin2",
192
+ },
193
+ {
194
+ pinIds: ["JP2.3", "U1.10"],
195
+ netId: "pinheader.JP2 > port.pin3 to .U1 > .pin10",
196
+ },
197
+ {
198
+ pinIds: ["JP2.4", "U1.11"],
199
+ netId: "pinheader.JP2 > port.pin4 to .U1 > .pin11",
200
+ },
201
+ {
202
+ pinIds: ["JP2.5", "U1.12"],
203
+ netId: "pinheader.JP2 > port.pin5 to .U1 > .pin12",
204
+ },
205
+ {
206
+ pinIds: ["JP2.6", "U1.13"],
207
+ netId: "pinheader.JP2 > port.pin6 to .U1 > .pin13",
208
+ },
209
+ ],
210
+ netConnections: [
211
+ {
212
+ netId: "V3_3",
213
+ pinIds: ["U1.1", "JP1.2"],
214
+ netLabelWidth: 0.4,
215
+ },
216
+ {
217
+ netId: "GND",
218
+ pinIds: ["U1.7", "JP1.1", "JP2.1"],
219
+ netLabelWidth: 0.3,
220
+ },
221
+ {
222
+ netId: "V5",
223
+ pinIds: ["U1.14", "JP2.2"],
224
+ netLabelWidth: 0.2,
225
+ },
226
+ ],
227
+ availableNetLabelOrientations: {
228
+ V3_3: ["y+"],
229
+ V5: ["y+"],
230
+ GND: ["y-"],
231
+ },
232
+ maxMspPairDistance: 5,
233
+ }
234
+
235
+ test("example01", () => {
236
+ const solver = new SchematicTracePipelineSolver(inputProblem)
237
+
238
+ solver.solve()
239
+
240
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
241
+ })
@@ -0,0 +1,13 @@
1
+ import { test, expect } from "bun:test"
2
+ import type { InputProblem } from "lib/index"
3
+ import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
4
+ import "tests/fixtures/matcher"
5
+ import inputProblem from "../../tests/assets/example25.json"
6
+
7
+ test("example28", () => {
8
+ const solver = new SchematicTracePipelineSolver(inputProblem as any)
9
+
10
+ solver.solve()
11
+
12
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
13
+ })