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-retained-via-route.test.ts

import {test,expect} from 'bun:test'
import {retainViaLaunch} from '../scripts/ddr-retained-via-route'
const prefix=[{route_type:'wire',x:0,y:0,layer:'top',width:.12,start_pcb_port_id:'original'},{route_type:'wire',x:1,y:1,layer:'top',width:.12},{route_type:'via',x:1,y:1,from_layer:'top',to_layer:'inner4',via_diameter:.4572,via_hole_diameter:.254}]
const w=(x:number,y:number)=>({route_type:'wire',x,y,layer:'inner4',width:.12})
test('materializes solver implicit departure and duplicate via while preserving actual launch',()=>{
 const raw=[...prefix,prefix[2],w(1,1.2),w(1.2,1.4)],old=structuredClone(raw),route=retainViaLaunch(raw,prefix)
 expect(raw).toEqual(old);expect(route.slice(0,3)).toEqual(prefix);expect(route[3]).toEqual(w(1,1));expect(route.filter(p=>p.route_type==='via')).toHaveLength(1)
})
test('rejects moved launch, new barrels and non45 implicit departures',()=>{
 const moved=structuredClone(prefix);moved[1]!.x=.9
 expect(()=>retainViaLaunch([...moved,w(1,1.2)],prefix)).toThrow()
 expect(()=>retainViaLaunch([...prefix,w(1,1.2),prefix[2]],prefix)).toThrow()
 expect(()=>retainViaLaunch([...prefix,w(1.1,1.2)],prefix)).toThrow()
})