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-host-corridors.test.ts
import {expect,test} from 'bun:test'
import {containsBounds,inflateBounds,outwardPort} from '../scripts/prepare-ddr-host-corridors'
const b={minX:-5,maxX:7,minY:-3,maxY:9}
test('asymmetric keepout expansion encloses copper caps on every side',()=>{
const box=inflateBounds(b,.1016)
expect(containsBounds(box,{minX:-5.0584,maxX:7.0584,minY:-3.0584,maxY:9.0584})).toBe(true)
expect(containsBounds(box,{...b,maxX:7.1017})).toBe(false)
expect(()=>inflateBounds(b,-1)).toThrow()
})
test('host leads continue outward exactly .5mm from each asymmetric edge',()=>{
for(const [point,expected] of [
[{x:-5,y:0,layer:'inner2'},{x:-5.5,y:0,layer:'inner2'}],
[{x:7,y:0,layer:'inner4'},{x:7.5,y:0,layer:'inner4'}],
[{x:0,y:-3,layer:'top'},{x:0,y:-3.5,layer:'top'}],
[{x:0,y:9,layer:'inner6'},{x:0,y:9.5,layer:'inner6'}],
])expect(outwardPort(point!,b)).toEqual(expected!)
})
test('interior and ambiguous corner ports cannot silently change location',()=>{
expect(()=>outwardPort({x:0,y:0,layer:'top'},b)).toThrow()
expect(()=>outwardPort({x:-5,y:9,layer:'top'},b)).toThrow()
expect(()=>outwardPort({x:-5,y:0,layer:'top'},b,0)).toThrow()
})