0hmX/am3352
This code suite comprises TypeScript scripts that analyze, verify, and assemble complex DDR memory interface hardware, focusing on physical routing, via and pad placement, electrical clearance, and physical constraints, often involving precise geometric calculations and consistent provenance tracking.
- Version
- 1.0.5
- License
- unset
- Stars
- 0
tests/ddr-inherited-plane-webs.test.ts
import{test,expect}from'bun:test'
import{bridgeInheritedPlaneWebs}from'../scripts/repair-ddr-inherited-plane-webs'
const radius=.3336/Math.cos(Math.PI/32),ring=(x:number,y:number)=>({vertices:Array.from({length:32},(_,i)=>({x:x+radius*Math.cos(i*Math.PI/16),y:y+radius*Math.sin(i*Math.PI/16)}))})
test('explicit bridge merges each inherited sliver without changing outer boundary',()=>{
const plane={type:'pcb_copper_pour',layer:'inner3',brep_shape:{outer_ring:{vertices:[{x:-20,y:-15},{x:0,y:-15},{x:0,y:10},{x:-20,y:10}]},inner_rings:[ring(-10.800054,-8.500046),ring(-11.1,-9.1),ring(-10.800054,4.499954),ring(-11.1,3.9)]}},before=JSON.stringify(plane),result=bridgeInheritedPlaneWebs(plane)
expect(JSON.stringify(plane)).toBe(before);expect(result.plane.brep_shape.outer_ring).toEqual(plane.brep_shape.outer_ring);expect(result.plane.brep_shape.inner_rings.length).toBe(2);expect(result.outerComponents).toBe(1);expect(result.changes.every(c=>Math.abs(c.beforeGapMm-.003305755855)<1e-8)).toBe(true)
})
test('repair refuses different plane or missing exact inherited hole pairs',()=>{expect(()=>bridgeInheritedPlaneWebs({type:'pcb_copper_pour',layer:'inner1'})).toThrow();expect(()=>bridgeInheritedPlaneWebs({type:'pcb_copper_pour',layer:'inner3',brep_shape:{outer_ring:{vertices:[{x:0,y:0},{x:1,y:0},{x:1,y:1}]},inner_rings:[]}})).toThrow()})