imrishabh18/pedometer
This code defines and assembles a simple radio receiver hardware circuit using specific imported capacitors, inductors, RF connectors, and oscillator components with precise footprints and schematic attributes.
- Version
- 1.1.3
- License
- unset
- Stars
- 0
tests/through-via-drc.test.ts
import { test, expect } from "bun:test";
import { AutoroutingPipelineSolver7_MultiGraph as Solver } from "@tscircuit/capacity-autorouter";
import { enableThroughViaDrc } from "../through-via-drc";
test("repair scoring sees a top pad crossed by a bottom-to-inner through via", () => {
const srj:any={layerCount:3,minTraceWidth:.1,minViaPadDiameter:.3,minViaHoleDiameter:.15,
bounds:{minX:-4,minY:-4,maxX:4,maxY:4},
obstacles:[{type:"rect",center:{x:0,y:0},width:.4,height:.4,layers:["top"],
connectedTo:["obstacle-net","pcb_smtpad_top"]}],
connections:[{name:"signal",pointsToConnect:[{x:-2,y:0,layer:"bottom"},{x:2,y:0,layer:"inner1"}]}]};
const hd:any={connectionName:"signal",traceThickness:.1,viaDiameter:.3,
route:[{x:-2,y:0,z:2},{x:0,y:0,z:2},{x:0,y:0,z:1},{x:2,y:0,z:1}],vias:[{x:0,y:0}]};
const s:any=new Solver(srj);
s.srjWithPointPairs=srj;s.netToPointPairsSolver={newConnections:srj.connections};
s.globalDrcForceImproveSolver={getOutput:()=>[hd]};
const step=s.pipelineDef.find((x:any)=>x.solverName==="exactGeometryDrcForceImproveSolver");
const original=structuredClone(hd);
enableThroughViaDrc(s,3);
const result=step.getConstructorParams(s)[0].drcEvaluator({hdRoutes:[hd]});
expect(result.errors.some((e:any)=>e.message.includes("pcb_smtpad_top"))).toBe(true);
expect(hd).toEqual(original);
});