@tscircuit/schematic-trace-solver 0.0.121 → 0.0.123

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.
Files changed (48) hide show
  1. package/dist/index.d.ts +10 -3
  2. package/dist/index.js +247 -31
  3. package/lib/solvers/RailNetLabelCornerPlacementSolver/RailNetLabelCornerPlacementSolver.ts +223 -21
  4. package/lib/solvers/RailNetLabelCornerPlacementSolver/types.ts +3 -3
  5. package/lib/solvers/SameNetJunctionAlignmentSolver/alignSameNetJunctions.ts +50 -5
  6. package/lib/solvers/SameNetJunctionAlignmentSolver/pathIntersectsAnyNetLabel.ts +29 -0
  7. package/lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts +34 -9
  8. package/package.json +1 -1
  9. package/site/bug-reports/bug-report-20260804T095800Z.page.tsx +4 -0
  10. package/site/bug-reports/bug-report-20260804T171919Z.page.tsx +4 -0
  11. package/site/bug-reports/bug-report-20260804T225912Z.page.tsx +4 -0
  12. package/tests/bug-reports/bug-report-20260706T213649Z/__snapshots__/bug-report-20260706T213649Z.snap.svg +4 -4
  13. package/tests/bug-reports/bug-report-20260706T220324Z/__snapshots__/bug-report-20260706T220324Z.snap.svg +5 -5
  14. package/tests/bug-reports/bug-report-20260717T042845Z/__snapshots__/bug-report-20260717T042845Z.snap.svg +12 -12
  15. package/tests/bug-reports/bug-report-20260721T221026Z/__snapshots__/bug-report-20260721T221026Z.snap.svg +2 -2
  16. package/tests/bug-reports/bug-report-20260728T144234Z/__snapshots__/bug-report-20260728T144234Z.snap.svg +2 -2
  17. package/tests/bug-reports/bug-report-20260804T095800Z/__snapshots__/bug-report-20260804T095800Z.snap.svg +135 -0
  18. package/tests/bug-reports/bug-report-20260804T095800Z/bug-report-20260804T095800Z.json +634 -0
  19. package/tests/bug-reports/bug-report-20260804T095800Z/bug-report-20260804T095800Z.test.ts +12 -0
  20. package/tests/bug-reports/bug-report-20260804T171919Z/__snapshots__/bug-report-20260804T171919Z.snap.svg +355 -0
  21. package/tests/bug-reports/bug-report-20260804T171919Z/bug-report-20260804T171919Z.json +1775 -0
  22. package/tests/bug-reports/bug-report-20260804T171919Z/bug-report-20260804T171919Z.test.ts +12 -0
  23. package/tests/bug-reports/bug-report-20260804T225912Z/__snapshots__/bug-report-20260804T225912Z.snap.svg +60 -0
  24. package/tests/bug-reports/bug-report-20260804T225912Z/bug-report-20260804T225912Z.json +148 -0
  25. package/tests/bug-reports/bug-report-20260804T225912Z/bug-report-20260804T225912Z.test.ts +12 -0
  26. package/tests/examples/__snapshots__/example12.snap.svg +2 -2
  27. package/tests/examples/__snapshots__/example13.snap.svg +4 -4
  28. package/tests/examples/__snapshots__/example14.snap.svg +36 -36
  29. package/tests/examples/__snapshots__/example31.snap.svg +6 -6
  30. package/tests/examples/__snapshots__/example43.snap.svg +2 -2
  31. package/tests/examples/__snapshots__/example44.snap.svg +2 -2
  32. package/tests/repros/__snapshots__/board-15984-same-net-junction.snap.svg +2 -2
  33. package/tests/repros/__snapshots__/bugreport-001-gnd-overlap.snap.svg +26 -26
  34. package/tests/repros/__snapshots__/netlabel-connector-through-rail-label.snap.svg +2 -2
  35. package/tests/repros/__snapshots__/repro-atmega328p-fault-pullup.snap.svg +2 -2
  36. package/tests/repros/__snapshots__/repro-atmega328p-missing-gnd-netlabel.snap.svg +2 -2
  37. package/tests/repros/__snapshots__/repro-bq25895-cross-net-trace-overlap.snap.svg +2 -2
  38. package/tests/repros/__snapshots__/repro-missing-trace-netlabel.snap.svg +18 -18
  39. package/tests/repros/__snapshots__/repro-netlabel-overlap-trace.snap.svg +3 -3
  40. package/tests/repros/__snapshots__/repro-nrf52810-clock-routing.snap.svg +82 -0
  41. package/tests/repros/__snapshots__/repro161-power-section-autolayout.snap.svg +112 -0
  42. package/tests/repros/assets/repro-nrf52810-clock-routing.input.json +234 -0
  43. package/tests/repros/assets/repro161-power-section-autolayout.input.json +578 -0
  44. package/tests/repros/repro-bq25895-cross-net-trace-overlap.test.ts +13 -0
  45. package/tests/repros/repro-missing-trace-netlabel.test.ts +12 -0
  46. package/tests/repros/repro-netlabel-overlap-trace.test.ts +38 -0
  47. package/tests/repros/repro-nrf52810-clock-routing.test.ts +28 -0
  48. package/tests/repros/repro161-power-section-autolayout.test.ts +34 -0
@@ -0,0 +1,578 @@
1
+ {
2
+ "chips": [
3
+ {
4
+ "chipId": "schematic_component_0",
5
+ "center": {
6
+ "x": 0,
7
+ "y": 0
8
+ },
9
+ "width": 2.5,
10
+ "height": 4,
11
+ "pins": [
12
+ {
13
+ "pinId": "schematic_port_0",
14
+ "x": 1.25,
15
+ "y": 1.4000000000000001
16
+ },
17
+ {
18
+ "pinId": "schematic_port_1",
19
+ "x": 1.25,
20
+ "y": 1.2
21
+ },
22
+ {
23
+ "pinId": "schematic_port_2",
24
+ "x": 1.25,
25
+ "y": 0.8499999999999999
26
+ },
27
+ {
28
+ "pinId": "schematic_port_3",
29
+ "x": 1.25,
30
+ "y": 0.6499999999999997
31
+ },
32
+ {
33
+ "pinId": "schematic_port_4",
34
+ "x": 1.25,
35
+ "y": 0.2999999999999998
36
+ },
37
+ {
38
+ "pinId": "schematic_port_5",
39
+ "x": 1.25,
40
+ "y": 0.09999999999999987
41
+ },
42
+ {
43
+ "pinId": "schematic_port_6",
44
+ "x": 1.25,
45
+ "y": -0.10000000000000009
46
+ },
47
+ {
48
+ "pinId": "schematic_port_7",
49
+ "x": 1.25,
50
+ "y": -0.30000000000000004
51
+ },
52
+ {
53
+ "pinId": "schematic_port_8",
54
+ "x": 1.25,
55
+ "y": -0.6500000000000001
56
+ },
57
+ {
58
+ "pinId": "schematic_port_9",
59
+ "x": 1.25,
60
+ "y": -0.8500000000000001
61
+ },
62
+ {
63
+ "pinId": "schematic_port_10",
64
+ "x": 1.25,
65
+ "y": -1.2000000000000002
66
+ },
67
+ {
68
+ "pinId": "schematic_port_11",
69
+ "x": 1.25,
70
+ "y": -1.4000000000000001
71
+ },
72
+ {
73
+ "pinId": "schematic_port_12",
74
+ "x": -0.37500000000000006,
75
+ "y": -2
76
+ },
77
+ {
78
+ "pinId": "schematic_port_13",
79
+ "x": -0.17500000000000004,
80
+ "y": -2
81
+ },
82
+ {
83
+ "pinId": "schematic_port_14",
84
+ "x": 0.024999999999999967,
85
+ "y": -2
86
+ },
87
+ {
88
+ "pinId": "schematic_port_15",
89
+ "x": 0.22500000000000003,
90
+ "y": -2
91
+ }
92
+ ],
93
+ "sectionId": "Power Input & 3V3 Regulator"
94
+ },
95
+ {
96
+ "chipId": "schematic_component_1",
97
+ "center": {
98
+ "x": 5.0249999999999995,
99
+ "y": -0.7950000000000014
100
+ },
101
+ "width": 1.040000000000001,
102
+ "height": 0.6799999999999999,
103
+ "pins": [
104
+ {
105
+ "pinId": "schematic_port_16",
106
+ "x": 4.504999999999999,
107
+ "y": -0.8650000000000013,
108
+ "_facingDirection": "x-"
109
+ },
110
+ {
111
+ "pinId": "schematic_port_17",
112
+ "x": 5.545,
113
+ "y": -0.8650000000000013,
114
+ "_facingDirection": "x+"
115
+ }
116
+ ],
117
+ "sectionId": "Power Input & 3V3 Regulator"
118
+ },
119
+ {
120
+ "chipId": "schematic_component_2",
121
+ "center": {
122
+ "x": 2.88,
123
+ "y": -0.6500000000000015
124
+ },
125
+ "width": 0.8399999999999999,
126
+ "height": 1.1000000000000003,
127
+ "pins": [
128
+ {
129
+ "pinId": "schematic_port_18",
130
+ "x": 3.1799999999999997,
131
+ "y": -0.10000000000000131
132
+ },
133
+ {
134
+ "pinId": "schematic_port_19",
135
+ "x": 3.19,
136
+ "y": -1.2000000000000015
137
+ },
138
+ {
139
+ "pinId": "schematic_port_20",
140
+ "x": 2.46,
141
+ "y": -0.7500000000000013
142
+ }
143
+ ],
144
+ "sectionId": "Power Input & 3V3 Regulator"
145
+ },
146
+ {
147
+ "chipId": "schematic_component_3",
148
+ "center": {
149
+ "x": 3.0125,
150
+ "y": 1.4099999999999986
151
+ },
152
+ "width": 1.0850000000000004,
153
+ "height": 0.6000000000000001,
154
+ "pins": [
155
+ {
156
+ "pinId": "schematic_port_21",
157
+ "x": 2.795,
158
+ "y": 1.7099999999999986,
159
+ "_facingDirection": "y+"
160
+ },
161
+ {
162
+ "pinId": "schematic_port_22",
163
+ "x": 2.795,
164
+ "y": 1.1099999999999985,
165
+ "_facingDirection": "y-"
166
+ }
167
+ ],
168
+ "sectionId": "Power Input & 3V3 Regulator"
169
+ },
170
+ {
171
+ "chipId": "schematic_component_4",
172
+ "center": {
173
+ "x": 2.65,
174
+ "y": -3.2050000000000014
175
+ },
176
+ "width": 2,
177
+ "height": 0.7999999999999998,
178
+ "pins": [
179
+ {
180
+ "pinId": "schematic_port_23",
181
+ "x": 1.65,
182
+ "y": -3.0050000000000012
183
+ },
184
+ {
185
+ "pinId": "schematic_port_24",
186
+ "x": 1.65,
187
+ "y": -3.2050000000000014
188
+ },
189
+ {
190
+ "pinId": "schematic_port_25",
191
+ "x": 1.65,
192
+ "y": -3.4050000000000016
193
+ },
194
+ {
195
+ "pinId": "schematic_port_26",
196
+ "x": 3.65,
197
+ "y": -3.3050000000000015
198
+ },
199
+ {
200
+ "pinId": "schematic_port_27",
201
+ "x": 3.65,
202
+ "y": -3.1050000000000013
203
+ }
204
+ ],
205
+ "sectionId": "Power Input & 3V3 Regulator"
206
+ },
207
+ {
208
+ "chipId": "schematic_component_5",
209
+ "center": {
210
+ "x": 5.055,
211
+ "y": 0.9799999999999988
212
+ },
213
+ "width": 0.9200000000000008,
214
+ "height": 0.76,
215
+ "pins": [
216
+ {
217
+ "pinId": "schematic_port_28",
218
+ "x": 4.92,
219
+ "y": 1.3599999999999988,
220
+ "_facingDirection": "y+"
221
+ },
222
+ {
223
+ "pinId": "schematic_port_29",
224
+ "x": 4.92,
225
+ "y": 0.5999999999999988,
226
+ "_facingDirection": "y-"
227
+ }
228
+ ],
229
+ "sectionId": "Power Input & 3V3 Regulator"
230
+ },
231
+ {
232
+ "chipId": "schematic_component_6",
233
+ "center": {
234
+ "x": 4.914999999999999,
235
+ "y": -3.8050000000000015
236
+ },
237
+ "width": 1.04,
238
+ "height": 0.7600000000000011,
239
+ "pins": [
240
+ {
241
+ "pinId": "schematic_port_30",
242
+ "x": 4.72,
243
+ "y": -3.4250000000000007,
244
+ "_facingDirection": "y+"
245
+ },
246
+ {
247
+ "pinId": "schematic_port_31",
248
+ "x": 4.72,
249
+ "y": -4.185000000000002,
250
+ "_facingDirection": "y-"
251
+ }
252
+ ],
253
+ "sectionId": "Power Input & 3V3 Regulator"
254
+ },
255
+ {
256
+ "chipId": "schematic_component_7",
257
+ "center": {
258
+ "x": 6.464999999999999,
259
+ "y": -3.8050000000000015
260
+ },
261
+ "width": 1.4499999999999993,
262
+ "height": 0.7799999999999994,
263
+ "pins": [
264
+ {
265
+ "pinId": "schematic_port_32",
266
+ "x": 6.289999999999999,
267
+ "y": -4.195000000000001,
268
+ "_facingDirection": "y-"
269
+ },
270
+ {
271
+ "pinId": "schematic_port_33",
272
+ "x": 6.289999999999999,
273
+ "y": -3.415000000000002,
274
+ "_facingDirection": "y+"
275
+ }
276
+ ],
277
+ "sectionId": "Power Input & 3V3 Regulator"
278
+ },
279
+ {
280
+ "chipId": "schematic_component_8",
281
+ "center": {
282
+ "x": 7.794999999999999,
283
+ "y": -3.8050000000000015
284
+ },
285
+ "width": 0.9199999999999999,
286
+ "height": 0.7600000000000011,
287
+ "pins": [
288
+ {
289
+ "pinId": "schematic_port_34",
290
+ "x": 7.659999999999999,
291
+ "y": -3.4250000000000007,
292
+ "_facingDirection": "y+"
293
+ },
294
+ {
295
+ "pinId": "schematic_port_35",
296
+ "x": 7.659999999999999,
297
+ "y": -4.185000000000002,
298
+ "_facingDirection": "y-"
299
+ }
300
+ ],
301
+ "sectionId": "Power Input & 3V3 Regulator"
302
+ },
303
+ {
304
+ "chipId": "schematic_component_9",
305
+ "center": {
306
+ "x": 9.8025,
307
+ "y": -5.3450000000000015
308
+ },
309
+ "width": 1.0150000000000006,
310
+ "height": 1.1300000000000008,
311
+ "pins": [
312
+ {
313
+ "pinId": "schematic_port_36",
314
+ "x": 9.62,
315
+ "y": -5.910000000000002,
316
+ "_facingDirection": "y-"
317
+ },
318
+ {
319
+ "pinId": "schematic_port_37",
320
+ "x": 9.62,
321
+ "y": -4.780000000000001,
322
+ "_facingDirection": "y+"
323
+ }
324
+ ],
325
+ "sectionId": "Power Input & 3V3 Regulator"
326
+ },
327
+ {
328
+ "chipId": "schematic_component_10",
329
+ "center": {
330
+ "x": 9.7775,
331
+ "y": -3.8050000000000015
332
+ },
333
+ "width": 0.9649999999999999,
334
+ "height": 0.6000000000000014,
335
+ "pins": [
336
+ {
337
+ "pinId": "schematic_port_38",
338
+ "x": 9.62,
339
+ "y": -4.105000000000002
340
+ },
341
+ {
342
+ "pinId": "schematic_port_39",
343
+ "x": 9.62,
344
+ "y": -3.505000000000001
345
+ }
346
+ ],
347
+ "sectionId": "Power Input & 3V3 Regulator"
348
+ },
349
+ {
350
+ "chipId": "schematic_component_11",
351
+ "center": {
352
+ "x": 0.19500000000000028,
353
+ "y": -7.1949999999999985
354
+ },
355
+ "width": 0.5,
356
+ "height": 0.7599999999999998,
357
+ "pins": [
358
+ {
359
+ "pinId": "schematic_port_40",
360
+ "x": 0.19500000000000026,
361
+ "y": -7.574999999999998,
362
+ "_facingDirection": "y-"
363
+ },
364
+ {
365
+ "pinId": "schematic_port_41",
366
+ "x": 0.1950000000000003,
367
+ "y": -6.814999999999999,
368
+ "_facingDirection": "y+"
369
+ }
370
+ ],
371
+ "sectionId": "Power Input & 3V3 Regulator"
372
+ },
373
+ {
374
+ "chipId": "schematic_component_12",
375
+ "center": {
376
+ "x": 4.8925,
377
+ "y": 2.7899999999999983
378
+ },
379
+ "width": 1.085,
380
+ "height": 0.5999999999999996,
381
+ "pins": [
382
+ {
383
+ "pinId": "schematic_port_42",
384
+ "x": 4.675,
385
+ "y": 3.089999999999998,
386
+ "_facingDirection": "y+"
387
+ },
388
+ {
389
+ "pinId": "schematic_port_43",
390
+ "x": 4.675,
391
+ "y": 2.4899999999999984,
392
+ "_facingDirection": "y-"
393
+ }
394
+ ],
395
+ "sectionId": "Power Input & 3V3 Regulator"
396
+ }
397
+ ],
398
+ "directConnections": [
399
+ {
400
+ "netId": ".U3 > .BYP to .C2 > .pin1",
401
+ "pinIds": [
402
+ "schematic_port_26",
403
+ "schematic_port_30"
404
+ ]
405
+ },
406
+ {
407
+ "netId": ".R1 > .pin1 to .LED1 > .cathode",
408
+ "pinIds": [
409
+ "schematic_port_38",
410
+ "schematic_port_37"
411
+ ]
412
+ }
413
+ ],
414
+ "netConnections": [
415
+ {
416
+ "netId": "V5",
417
+ "netLabelWidth": 0.42,
418
+ "netLabelHeight": 0.36,
419
+ "pinIds": [
420
+ "schematic_port_0",
421
+ "schematic_port_1",
422
+ "schematic_port_17",
423
+ "schematic_port_20",
424
+ "schematic_port_21"
425
+ ]
426
+ },
427
+ {
428
+ "netId": "DP",
429
+ "netLabelWidth": 0.36,
430
+ "pinIds": [
431
+ "schematic_port_4",
432
+ "schematic_port_5"
433
+ ]
434
+ },
435
+ {
436
+ "netId": "DM",
437
+ "netLabelWidth": 0.36,
438
+ "pinIds": [
439
+ "schematic_port_6",
440
+ "schematic_port_7"
441
+ ]
442
+ },
443
+ {
444
+ "netId": "GND",
445
+ "netLabelWidth": 0.42,
446
+ "netLabelHeight": 0.48,
447
+ "pinIds": [
448
+ "schematic_port_10",
449
+ "schematic_port_11",
450
+ "schematic_port_12",
451
+ "schematic_port_13",
452
+ "schematic_port_14",
453
+ "schematic_port_15",
454
+ "schematic_port_22",
455
+ "schematic_port_24",
456
+ "schematic_port_29",
457
+ "schematic_port_31",
458
+ "schematic_port_32",
459
+ "schematic_port_35",
460
+ "schematic_port_36",
461
+ "schematic_port_40"
462
+ ]
463
+ },
464
+ {
465
+ "netId": "VBUS",
466
+ "netLabelWidth": 0.42,
467
+ "netLabelHeight": 0.6,
468
+ "pinIds": [
469
+ "schematic_port_16",
470
+ "schematic_port_19",
471
+ "schematic_port_23",
472
+ "schematic_port_28",
473
+ "schematic_port_42"
474
+ ]
475
+ },
476
+ {
477
+ "netId": "BATT",
478
+ "netLabelWidth": 0.6,
479
+ "pinIds": [
480
+ "schematic_port_18"
481
+ ]
482
+ },
483
+ {
484
+ "netId": "LDO_EN",
485
+ "netLabelWidth": 0.84,
486
+ "pinIds": [
487
+ "schematic_port_25",
488
+ "schematic_port_41"
489
+ ]
490
+ },
491
+ {
492
+ "netId": "V3V3",
493
+ "netLabelWidth": 0.42,
494
+ "netLabelHeight": 0.6,
495
+ "pinIds": [
496
+ "schematic_port_27",
497
+ "schematic_port_33",
498
+ "schematic_port_34",
499
+ "schematic_port_39"
500
+ ]
501
+ },
502
+ {
503
+ "netId": "LDO_H",
504
+ "netLabelWidth": 0.72,
505
+ "pinIds": [
506
+ "schematic_port_43"
507
+ ]
508
+ }
509
+ ],
510
+ "textBoxes": [
511
+ {
512
+ "chipId": "schematic_component_0",
513
+ "center": {
514
+ "x": 1.07,
515
+ "y": 1.7149999999999999
516
+ },
517
+ "width": 0.3599999999999999,
518
+ "height": 0.24999999999999978,
519
+ "text": "J1"
520
+ },
521
+ {
522
+ "chipId": "schematic_component_4",
523
+ "center": {
524
+ "x": 3.07,
525
+ "y": -3.735000000000001
526
+ },
527
+ "width": 2.04,
528
+ "height": 0.17999999999999972,
529
+ "text": "MIC5219_3_3YM5_TR"
530
+ },
531
+ {
532
+ "chipId": "schematic_component_4",
533
+ "center": {
534
+ "x": 2.17,
535
+ "y": -2.6900000000000013
536
+ },
537
+ "width": 0.3600000000000003,
538
+ "height": 0.24999999999999956,
539
+ "text": "U3"
540
+ }
541
+ ],
542
+ "availableNetLabelOrientations": {
543
+ "V5": [
544
+ "y+"
545
+ ],
546
+ "GND": [
547
+ "y-"
548
+ ],
549
+ "DP": [
550
+ "x-",
551
+ "x+"
552
+ ],
553
+ "DM": [
554
+ "x-",
555
+ "x+"
556
+ ],
557
+ "VBUS": [
558
+ "y+"
559
+ ],
560
+ "BATT": [
561
+ "x-",
562
+ "x+"
563
+ ],
564
+ "LDO_EN": [
565
+ "x-",
566
+ "x+"
567
+ ],
568
+ "V3V3": [
569
+ "y+"
570
+ ],
571
+ "LDO_H": [
572
+ "x-",
573
+ "x+"
574
+ ]
575
+ },
576
+ "maxMspPairDistance": 8,
577
+ "_hideRatsNet": false
578
+ }
@@ -1,6 +1,7 @@
1
1
  import { expect, test } from "bun:test"
2
2
  import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
3
  import type { SolvedTracePath } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver"
4
+ import { getTraceCorners } from "lib/solvers/RailNetLabelCornerPlacementSolver/geometry"
4
5
  import { SCHEMATIC_TRACE_MIN_VISUAL_CENTERLINE_CLEARANCE } from "lib/utils/doesPathCoincideWithTraces"
5
6
  import "tests/fixtures/matcher"
6
7
  import inputProblem from "./assets/repro-bq25895-cross-net-trace-overlap.input.json"
@@ -71,5 +72,17 @@ test("BQ25895 CE and GND traces keep visible parallel clearance", () => {
71
72
  )
72
73
 
73
74
  expect(hasInsufficientCeAndGroundClearance).toBe(false)
75
+
76
+ const output = solver.netLabelTraceCollisionSolver!.getOutput()
77
+ const groundLabel = output.netLabelPlacements.find(
78
+ (label) => label.netId === "GND",
79
+ )!
80
+ const groundLabelTrace = output.traces.find((trace) =>
81
+ groundLabel.mspConnectionPairIds.includes(trace.mspPairId),
82
+ )!
83
+
84
+ expect(getTraceCorners(groundLabelTrace.tracePath)).toContainEqual(
85
+ groundLabel.anchorPoint,
86
+ )
74
87
  expect(solver).toMatchSolverSnapshot(import.meta.path)
75
88
  })
@@ -1,4 +1,5 @@
1
1
  import { expect, test } from "bun:test"
2
+ import { getTraceCorners } from "lib/solvers/RailNetLabelCornerPlacementSolver/geometry"
2
3
  import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
4
  import inputProblem from "./assets/repro-missing-trace-netlabel.input.json"
4
5
  import "tests/fixtures/matcher"
@@ -10,5 +11,16 @@ test("repro148 missing trace becomes net labels", () => {
10
11
 
11
12
  solver.solve()
12
13
 
14
+ const output = solver.sameNetJunctionAlignmentSolver!.getOutput()
15
+ const powerLabel = output.netLabelPlacements.find(
16
+ (label) => label.netId === "V3V3",
17
+ )!
18
+ const powerTrace = output.traces.find((trace) =>
19
+ powerLabel.mspConnectionPairIds.includes(trace.mspPairId),
20
+ )!
21
+
22
+ expect(getTraceCorners(powerTrace.tracePath)).toContainEqual(
23
+ powerLabel.anchorPoint,
24
+ )
13
25
  expect(solver).toMatchSolverSnapshot(import.meta.path)
14
26
  })
@@ -1,4 +1,10 @@
1
1
  import { expect, test } from "bun:test"
2
+ import { traceCrossesBoundsInterior } from "lib/solvers/AvailableNetOrientationSolver/geometry"
3
+ import {
4
+ getTraceCorners,
5
+ rectsOverlap,
6
+ } from "lib/solvers/RailNetLabelCornerPlacementSolver/geometry"
7
+ import { getRectBounds } from "lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/geometry"
2
8
  import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
9
  import inputProblem from "./assets/repro-netlabel-overlap-trace.input.json"
4
10
  import "tests/fixtures/matcher"
@@ -10,5 +16,37 @@ test("repro147 netlabel overlaps trace", () => {
10
16
 
11
17
  solver.solve()
12
18
 
19
+ const output = solver.sameNetJunctionAlignmentSolver!.getOutput()
20
+ const groundLabel = output.netLabelPlacements.find(
21
+ (label) => label.netId === "GND",
22
+ )!
23
+ const groundTrace = output.traces.find((trace) =>
24
+ groundLabel.mspConnectionPairIds.includes(trace.mspPairId),
25
+ )!
26
+ const groundLabelBounds = getRectBounds(
27
+ groundLabel.center,
28
+ groundLabel.width,
29
+ groundLabel.height,
30
+ )
31
+
32
+ expect(getTraceCorners(groundTrace.tracePath)).toContainEqual(
33
+ groundLabel.anchorPoint,
34
+ )
35
+ expect(
36
+ inputProblem.chips.some((chip) =>
37
+ rectsOverlap(
38
+ groundLabelBounds,
39
+ getRectBounds(chip.center, chip.width, chip.height),
40
+ ),
41
+ ),
42
+ ).toBe(false)
43
+ expect(
44
+ traceCrossesBoundsInterior(
45
+ groundLabelBounds,
46
+ Object.fromEntries(
47
+ output.traces.map((trace) => [trace.mspPairId, trace]),
48
+ ),
49
+ ),
50
+ ).toBe(false)
13
51
  expect(solver).toMatchSolverSnapshot(import.meta.path)
14
52
  })
@@ -0,0 +1,28 @@
1
+ import { expect, test } from "bun:test"
2
+ import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
+ import "tests/fixtures/matcher"
4
+ import inputProblem from "./assets/repro-nrf52810-clock-routing.input.json"
5
+
6
+ // Extracted from the nRF52810 clock-source schematic shown in the reproduction:
7
+ // a four-pin 32 MHz crystal and a two-pin 32.768 kHz crystal, each connected
8
+ // to an MCU schematic box, two load capacitors, and section-local GND labels.
9
+ test("repro nRF52810 HF and LF crystal trace/net-label routing", () => {
10
+ const solver = new SchematicTracePipelineSolver(inputProblem as any)
11
+
12
+ solver.solve()
13
+
14
+ expect(solver.mspConnectionPairSolver?.mspConnectionPairs).toHaveLength(11)
15
+ expect(
16
+ solver.schematicTraceLinesSolver?.failedConnectionPairs.map(
17
+ (pair) => pair.mspPairId,
18
+ ),
19
+ ).toEqual([
20
+ "schematic_port_39-schematic_port_43", // U1.XC2 -> X1.XTAL2
21
+ "schematic_port_45-schematic_port_47", // U1.XL2 -> X2.OSC2
22
+ "schematic_port_41-schematic_port_40", // X1.GND2 -> X1.GND1
23
+ ])
24
+ expect(
25
+ solver.sameNetJunctionAlignmentSolver?.getOutput().netLabelPlacements,
26
+ ).toHaveLength(10)
27
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
28
+ })