@tscircuit/schematic-trace-solver 0.0.90 → 0.0.92
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 +121 -2
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2.ts +20 -14
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/calculateDirectShortPath.ts +161 -0
- package/lib/solvers/SchematicTracePipelineSolver/correctPinsInsideChip.ts +19 -0
- package/package.json +1 -1
- package/site/bug-reports/bug-report-20260707T230831Z.page.tsx +4 -0
- package/site/bug-reports/bug-report-20260708T053736Z.page.tsx +4 -0
- package/site/bug-reports/bug-report-20260708T055430Z.page.tsx +4 -0
- package/site/bug-reports/bug-report-20260708T095725Z.page.tsx +4 -0
- package/tests/bug-reports/bug-report-20260707T230831Z/__snapshots__/bug-report-20260707T230831Z.snap.svg +88 -0
- package/tests/bug-reports/bug-report-20260707T230831Z/bug-report-20260707T230831Z.json +347 -0
- package/tests/bug-reports/bug-report-20260707T230831Z/bug-report-20260707T230831Z.test.ts +12 -0
- package/tests/bug-reports/bug-report-20260708T053736Z/__snapshots__/bug-report-20260708T053736Z.snap.svg +52 -0
- package/tests/bug-reports/bug-report-20260708T053736Z/bug-report-20260708T053736Z.json +59 -0
- package/tests/bug-reports/bug-report-20260708T053736Z/bug-report-20260708T053736Z.test.ts +12 -0
- package/tests/bug-reports/bug-report-20260708T055430Z/__snapshots__/bug-report-20260708T055430Z.snap.svg +88 -0
- package/tests/bug-reports/bug-report-20260708T055430Z/bug-report-20260708T055430Z.json +263 -0
- package/tests/bug-reports/bug-report-20260708T055430Z/bug-report-20260708T055430Z.test.ts +12 -0
- package/tests/bug-reports/bug-report-20260708T095725Z/__snapshots__/bug-report-20260708T095725Z.snap.svg +87 -0
- package/tests/bug-reports/bug-report-20260708T095725Z/bug-report-20260708T095725Z.json +277 -0
- package/tests/bug-reports/bug-report-20260708T095725Z/bug-report-20260708T095725Z.test.ts +12 -0
- package/tests/repros/__snapshots__/repro-missing-trace-netlabel.snap.svg +62 -0
- package/tests/repros/__snapshots__/repro-netlabel-overlap-trace.snap.svg +60 -0
- package/tests/repros/__snapshots__/repro-rectifier-trace-overlap.snap.svg +58 -0
- package/tests/repros/__snapshots__/small-variant-resistor-facing-direction.snap.svg +86 -0
- package/tests/repros/assets/repro-missing-trace-netlabel.input.json +155 -0
- package/tests/repros/assets/repro-netlabel-overlap-trace.input.json +115 -0
- package/tests/repros/assets/repro-rectifier-trace-overlap.input.json +137 -0
- package/tests/repros/assets/small-variant-resistor-facing-direction.input.json +297 -0
- package/tests/repros/repro-missing-trace-netlabel.test.ts +14 -0
- package/tests/repros/repro-netlabel-overlap-trace.test.ts +14 -0
- package/tests/repros/repro-rectifier-trace-overlap.test.ts +14 -0
- package/tests/repros/small-variant-resistor-facing-direction.test.ts +35 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
{
|
|
2
|
+
"chips": [
|
|
3
|
+
{
|
|
4
|
+
"chipId": "schematic_component_0",
|
|
5
|
+
"center": {
|
|
6
|
+
"x": 0,
|
|
7
|
+
"y": 0
|
|
8
|
+
},
|
|
9
|
+
"width": 1.08,
|
|
10
|
+
"height": 0.818910699999999,
|
|
11
|
+
"pins": [
|
|
12
|
+
{
|
|
13
|
+
"pinId": "V1.1",
|
|
14
|
+
"x": -0.54,
|
|
15
|
+
"y": -0.0050000000000000044,
|
|
16
|
+
"_facingDirection": "x-"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"pinId": "V1.2",
|
|
20
|
+
"x": 0.54,
|
|
21
|
+
"y": 0.0049999999999999975,
|
|
22
|
+
"_facingDirection": "x+"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"chipId": "schematic_component_1",
|
|
28
|
+
"center": {
|
|
29
|
+
"x": 0.019999999999999796,
|
|
30
|
+
"y": 1.4194553499999993
|
|
31
|
+
},
|
|
32
|
+
"width": 1.04,
|
|
33
|
+
"height": 0.6799999999999999,
|
|
34
|
+
"pins": [
|
|
35
|
+
{
|
|
36
|
+
"pinId": "D1.1",
|
|
37
|
+
"x": -0.5000000000000002,
|
|
38
|
+
"y": 1.3494553499999995,
|
|
39
|
+
"_facingDirection": "x-"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"pinId": "D1.2",
|
|
43
|
+
"x": 0.5399999999999998,
|
|
44
|
+
"y": 1.3494553499999995,
|
|
45
|
+
"_facingDirection": "x+"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"chipId": "schematic_component_2",
|
|
51
|
+
"center": {
|
|
52
|
+
"x": 2.8400000000000003,
|
|
53
|
+
"y": 0.004999999999999449
|
|
54
|
+
},
|
|
55
|
+
"width": 0.5999999999999996,
|
|
56
|
+
"height": 0.6799999999999999,
|
|
57
|
+
"pins": [
|
|
58
|
+
{
|
|
59
|
+
"pinId": "R1.1",
|
|
60
|
+
"x": 3.14,
|
|
61
|
+
"y": 0.004999999999999413,
|
|
62
|
+
"_facingDirection": "x+"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"pinId": "R1.2",
|
|
66
|
+
"x": 2.5400000000000005,
|
|
67
|
+
"y": 0.004999999999999486,
|
|
68
|
+
"_facingDirection": "x-"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"chipId": "schematic_component_3",
|
|
74
|
+
"center": {
|
|
75
|
+
"x": 1.54,
|
|
76
|
+
"y": 0.004999999999999893
|
|
77
|
+
},
|
|
78
|
+
"width": 0.6000000000000001,
|
|
79
|
+
"height": 0.84,
|
|
80
|
+
"pins": [
|
|
81
|
+
{
|
|
82
|
+
"pinId": "C1.1",
|
|
83
|
+
"x": 1.84,
|
|
84
|
+
"y": 0.004999999999999857,
|
|
85
|
+
"_facingDirection": "x+"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"pinId": "C1.2",
|
|
89
|
+
"x": 1.24,
|
|
90
|
+
"y": 0.00499999999999993,
|
|
91
|
+
"_facingDirection": "x-"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"directConnections": [
|
|
97
|
+
{
|
|
98
|
+
"pinIds": [
|
|
99
|
+
"V1.1",
|
|
100
|
+
"D1.1"
|
|
101
|
+
],
|
|
102
|
+
"netId": ".V1 > .pin1 to .D1 > .anode"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"pinIds": [
|
|
106
|
+
"D1.2",
|
|
107
|
+
"R1.1"
|
|
108
|
+
],
|
|
109
|
+
"netId": ".D1 > .cathode to .R1 > .pin1"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"pinIds": [
|
|
113
|
+
"D1.2",
|
|
114
|
+
"C1.1"
|
|
115
|
+
],
|
|
116
|
+
"netId": ".D1 > .cathode to .C1 > .pin1"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"pinIds": [
|
|
120
|
+
"V1.2",
|
|
121
|
+
"R1.2"
|
|
122
|
+
],
|
|
123
|
+
"netId": ".V1 > .pin2 to .R1 > .pin2"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"pinIds": [
|
|
127
|
+
"V1.2",
|
|
128
|
+
"C1.2"
|
|
129
|
+
],
|
|
130
|
+
"netId": ".V1 > .pin2 to .C1 > .pin2"
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
"netConnections": [],
|
|
134
|
+
"textBoxes": [],
|
|
135
|
+
"availableNetLabelOrientations": {},
|
|
136
|
+
"maxMspPairDistance": 10
|
|
137
|
+
}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
{
|
|
2
|
+
"chips": [
|
|
3
|
+
{
|
|
4
|
+
"chipId": "schematic_component_0",
|
|
5
|
+
"center": {
|
|
6
|
+
"x": 10,
|
|
7
|
+
"y": 14
|
|
8
|
+
},
|
|
9
|
+
"width": 2.1999999999999993,
|
|
10
|
+
"height": 3.3999999999999986,
|
|
11
|
+
"pins": [
|
|
12
|
+
{
|
|
13
|
+
"pinId": "U_MCU.1",
|
|
14
|
+
"x": 8.9,
|
|
15
|
+
"y": 15.5,
|
|
16
|
+
"_facingDirection": "x-"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"pinId": "U_MCU.2",
|
|
20
|
+
"x": 8.9,
|
|
21
|
+
"y": 15.3,
|
|
22
|
+
"_facingDirection": "x-"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"pinId": "U_MCU.3",
|
|
26
|
+
"x": 8.9,
|
|
27
|
+
"y": 15.1,
|
|
28
|
+
"_facingDirection": "x-"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"pinId": "U_MCU.4",
|
|
32
|
+
"x": 8.9,
|
|
33
|
+
"y": 14.9,
|
|
34
|
+
"_facingDirection": "x-"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"pinId": "U_MCU.5",
|
|
38
|
+
"x": 8.9,
|
|
39
|
+
"y": 14.7,
|
|
40
|
+
"_facingDirection": "x-"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"pinId": "U_MCU.6",
|
|
44
|
+
"x": 8.9,
|
|
45
|
+
"y": 14.5,
|
|
46
|
+
"_facingDirection": "x-"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"pinId": "U_MCU.7",
|
|
50
|
+
"x": 8.9,
|
|
51
|
+
"y": 14.3,
|
|
52
|
+
"_facingDirection": "x-"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"pinId": "U_MCU.8",
|
|
56
|
+
"x": 8.9,
|
|
57
|
+
"y": 14.1,
|
|
58
|
+
"_facingDirection": "x-"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"pinId": "U_MCU.9",
|
|
62
|
+
"x": 8.9,
|
|
63
|
+
"y": 13.9,
|
|
64
|
+
"_facingDirection": "x-"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"pinId": "U_MCU.10",
|
|
68
|
+
"x": 8.9,
|
|
69
|
+
"y": 13.700000000000001,
|
|
70
|
+
"_facingDirection": "x-"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"pinId": "U_MCU.11",
|
|
74
|
+
"x": 8.9,
|
|
75
|
+
"y": 13.5,
|
|
76
|
+
"_facingDirection": "x-"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"pinId": "U_MCU.12",
|
|
80
|
+
"x": 8.9,
|
|
81
|
+
"y": 13.3,
|
|
82
|
+
"_facingDirection": "x-"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"pinId": "U_MCU.13",
|
|
86
|
+
"x": 8.9,
|
|
87
|
+
"y": 13.1,
|
|
88
|
+
"_facingDirection": "x-"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"pinId": "U_MCU.14",
|
|
92
|
+
"x": 8.9,
|
|
93
|
+
"y": 12.9,
|
|
94
|
+
"_facingDirection": "x-"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"pinId": "U_MCU.15",
|
|
98
|
+
"x": 8.9,
|
|
99
|
+
"y": 12.7,
|
|
100
|
+
"_facingDirection": "x-"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"pinId": "U_MCU.16",
|
|
104
|
+
"x": 8.9,
|
|
105
|
+
"y": 12.5,
|
|
106
|
+
"_facingDirection": "x-"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"pinId": "U_MCU.17",
|
|
110
|
+
"x": 11.1,
|
|
111
|
+
"y": 12.5,
|
|
112
|
+
"_facingDirection": "x+"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"pinId": "U_MCU.18",
|
|
116
|
+
"x": 11.1,
|
|
117
|
+
"y": 12.7,
|
|
118
|
+
"_facingDirection": "x+"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"pinId": "U_MCU.19",
|
|
122
|
+
"x": 11.1,
|
|
123
|
+
"y": 12.9,
|
|
124
|
+
"_facingDirection": "x+"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"pinId": "U_MCU.20",
|
|
128
|
+
"x": 11.1,
|
|
129
|
+
"y": 13.1,
|
|
130
|
+
"_facingDirection": "x+"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"pinId": "U_MCU.21",
|
|
134
|
+
"x": 11.1,
|
|
135
|
+
"y": 13.3,
|
|
136
|
+
"_facingDirection": "x+"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"pinId": "U_MCU.22",
|
|
140
|
+
"x": 11.1,
|
|
141
|
+
"y": 13.5,
|
|
142
|
+
"_facingDirection": "x+"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"pinId": "U_MCU.23",
|
|
146
|
+
"x": 11.1,
|
|
147
|
+
"y": 13.7,
|
|
148
|
+
"_facingDirection": "x+"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"pinId": "U_MCU.24",
|
|
152
|
+
"x": 11.1,
|
|
153
|
+
"y": 13.9,
|
|
154
|
+
"_facingDirection": "x+"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"pinId": "U_MCU.25",
|
|
158
|
+
"x": 11.1,
|
|
159
|
+
"y": 14.1,
|
|
160
|
+
"_facingDirection": "x+"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"pinId": "U_MCU.26",
|
|
164
|
+
"x": 11.1,
|
|
165
|
+
"y": 14.299999999999999,
|
|
166
|
+
"_facingDirection": "x+"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"pinId": "U_MCU.27",
|
|
170
|
+
"x": 11.1,
|
|
171
|
+
"y": 14.5,
|
|
172
|
+
"_facingDirection": "x+"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"pinId": "U_MCU.28",
|
|
176
|
+
"x": 11.1,
|
|
177
|
+
"y": 14.7,
|
|
178
|
+
"_facingDirection": "x+"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"pinId": "U_MCU.29",
|
|
182
|
+
"x": 11.1,
|
|
183
|
+
"y": 14.9,
|
|
184
|
+
"_facingDirection": "x+"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"pinId": "U_MCU.30",
|
|
188
|
+
"x": 11.1,
|
|
189
|
+
"y": 15.1,
|
|
190
|
+
"_facingDirection": "x+"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"pinId": "U_MCU.31",
|
|
194
|
+
"x": 11.1,
|
|
195
|
+
"y": 15.3,
|
|
196
|
+
"_facingDirection": "x+"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"pinId": "U_MCU.32",
|
|
200
|
+
"x": 11.1,
|
|
201
|
+
"y": 15.5,
|
|
202
|
+
"_facingDirection": "x+"
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"chipId": "schematic_component_1",
|
|
208
|
+
"center": {
|
|
209
|
+
"x": 14,
|
|
210
|
+
"y": 10
|
|
211
|
+
},
|
|
212
|
+
"width": 1.6799999999999997,
|
|
213
|
+
"height": 0.6799999999999997,
|
|
214
|
+
"pins": [
|
|
215
|
+
{
|
|
216
|
+
"pinId": "R_FAULT_PULLUP.1",
|
|
217
|
+
"x": 13.7,
|
|
218
|
+
"y": 10,
|
|
219
|
+
"_facingDirection": "x-"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"pinId": "R_FAULT_PULLUP.2",
|
|
223
|
+
"x": 14.3,
|
|
224
|
+
"y": 10,
|
|
225
|
+
"_facingDirection": "x+"
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
],
|
|
230
|
+
"directConnections": [],
|
|
231
|
+
"netConnections": [
|
|
232
|
+
{
|
|
233
|
+
"netId": "GND",
|
|
234
|
+
"pinIds": [
|
|
235
|
+
"U_MCU.3",
|
|
236
|
+
"U_MCU.5",
|
|
237
|
+
"U_MCU.21"
|
|
238
|
+
],
|
|
239
|
+
"netLabelWidth": 0.42,
|
|
240
|
+
"netLabelHeight": 0.48
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"netId": "VCC_3V3",
|
|
244
|
+
"pinIds": [
|
|
245
|
+
"U_MCU.4",
|
|
246
|
+
"U_MCU.6",
|
|
247
|
+
"U_MCU.18",
|
|
248
|
+
"R_FAULT_PULLUP.1"
|
|
249
|
+
],
|
|
250
|
+
"netLabelWidth": 0.42,
|
|
251
|
+
"netLabelHeight": 0.96
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"netId": "FAULT",
|
|
255
|
+
"pinIds": [
|
|
256
|
+
"U_MCU.32",
|
|
257
|
+
"R_FAULT_PULLUP.2"
|
|
258
|
+
],
|
|
259
|
+
"netLabelWidth": 0.72
|
|
260
|
+
}
|
|
261
|
+
],
|
|
262
|
+
"textBoxes": [
|
|
263
|
+
{
|
|
264
|
+
"chipId": "schematic_component_0",
|
|
265
|
+
"center": {
|
|
266
|
+
"x": 10.080000000000002,
|
|
267
|
+
"y": 12.17
|
|
268
|
+
},
|
|
269
|
+
"width": 1.5600000000000005,
|
|
270
|
+
"height": 0.17999999999999972,
|
|
271
|
+
"text": "ATMEGA328P_AU"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"chipId": "schematic_component_0",
|
|
275
|
+
"center": {
|
|
276
|
+
"x": 9.600000000000001,
|
|
277
|
+
"y": 15.815
|
|
278
|
+
},
|
|
279
|
+
"width": 0.7200000000000006,
|
|
280
|
+
"height": 0.25,
|
|
281
|
+
"text": "U_MCU"
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"availableNetLabelOrientations": {
|
|
285
|
+
"VCC_3V3": [
|
|
286
|
+
"y+"
|
|
287
|
+
],
|
|
288
|
+
"GND": [
|
|
289
|
+
"y-"
|
|
290
|
+
],
|
|
291
|
+
"FAULT": [
|
|
292
|
+
"x-",
|
|
293
|
+
"x+"
|
|
294
|
+
]
|
|
295
|
+
},
|
|
296
|
+
"maxMspPairDistance": 2.4
|
|
297
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
3
|
+
import inputProblem from "./assets/repro-missing-trace-netlabel.input.json"
|
|
4
|
+
import "tests/fixtures/matcher"
|
|
5
|
+
|
|
6
|
+
// Regression (from @tscircuit/core repro148): the RESET connection between R3 and
|
|
7
|
+
// SW2 used to route as a trace but now falls back to two net labels.
|
|
8
|
+
test("repro148 missing trace becomes net labels", () => {
|
|
9
|
+
const solver = new SchematicTracePipelineSolver(inputProblem as any)
|
|
10
|
+
|
|
11
|
+
solver.solve()
|
|
12
|
+
|
|
13
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
14
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
3
|
+
import inputProblem from "./assets/repro-netlabel-overlap-trace.input.json"
|
|
4
|
+
import "tests/fixtures/matcher"
|
|
5
|
+
|
|
6
|
+
// Regression (from @tscircuit/core repro147): a GND net label ends up overlapping
|
|
7
|
+
// the B1/SW1 junction trace instead of being placed clear of it.
|
|
8
|
+
test("repro147 netlabel overlaps trace", () => {
|
|
9
|
+
const solver = new SchematicTracePipelineSolver(inputProblem as any)
|
|
10
|
+
|
|
11
|
+
solver.solve()
|
|
12
|
+
|
|
13
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
14
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
3
|
+
import inputProblem from "./assets/repro-rectifier-trace-overlap.input.json"
|
|
4
|
+
import "tests/fixtures/matcher"
|
|
5
|
+
|
|
6
|
+
// Regression (from @tscircuit/core half-bridge-rectifier): the R1->C1 connection
|
|
7
|
+
// used to be a simple direct trace but now detours and overlaps another trace.
|
|
8
|
+
test("repro149 rectifier trace overlap", () => {
|
|
9
|
+
const solver = new SchematicTracePipelineSolver(inputProblem as any)
|
|
10
|
+
|
|
11
|
+
solver.solve()
|
|
12
|
+
|
|
13
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
14
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
3
|
+
import inputProblem from "./assets/small-variant-resistor-facing-direction.input.json"
|
|
4
|
+
import "tests/fixtures/matcher"
|
|
5
|
+
|
|
6
|
+
// Regression for a small-variant resistor (R_FAULT_PULLUP) whose wide
|
|
7
|
+
// reference-designator text inflates its chip box, so its two ports sit *inside*
|
|
8
|
+
// the box rather than on an edge.
|
|
9
|
+
//
|
|
10
|
+
// The input supplies each port's facing direction (as @tscircuit/core does from
|
|
11
|
+
// the schematic symbol). The solver must snap such inside-pins to the box edge
|
|
12
|
+
// ALONG that facing (correctPinsInsideChips) instead of guessing the nearest
|
|
13
|
+
// edge — which, for a horizontal resistor whose ref text widened the box, is the
|
|
14
|
+
// bottom edge, wrongly making both terminals face "y-" and routing downward.
|
|
15
|
+
test("small-variant resistor with facing directions routes from the sides", () => {
|
|
16
|
+
const solver = new SchematicTracePipelineSolver(inputProblem as any)
|
|
17
|
+
|
|
18
|
+
solver.solve()
|
|
19
|
+
|
|
20
|
+
const resistor = solver.inputProblem.chips.find(
|
|
21
|
+
(c) => c.chipId === "schematic_component_1",
|
|
22
|
+
)!
|
|
23
|
+
// Terminals keep their symbol-provided facing instead of being re-detected as
|
|
24
|
+
// facing down, and are snapped to the left/right edges of the inflated box.
|
|
25
|
+
expect(resistor.pins.map((p) => p._facingDirection).sort()).toEqual([
|
|
26
|
+
"x+",
|
|
27
|
+
"x-",
|
|
28
|
+
])
|
|
29
|
+
const left = resistor.pins.find((p) => p._facingDirection === "x-")!
|
|
30
|
+
const right = resistor.pins.find((p) => p._facingDirection === "x+")!
|
|
31
|
+
expect(left.x).toBeCloseTo(resistor.center.x - resistor.width / 2)
|
|
32
|
+
expect(right.x).toBeCloseTo(resistor.center.x + resistor.width / 2)
|
|
33
|
+
|
|
34
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
35
|
+
})
|