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-reference-coverage.test.ts

import { test, expect } from 'bun:test'
import { planeCoverageIntervals } from '../scripts/audit-ddr-host-reference-coverage'
const rect=(x:number,y:number,w:number,h:number)=>({vertices:[{x,y},{x:x+w,y},{x:x+w,y:y+h},{x,y:y+h}]})
const uncovered=(rows:any[])=>rows.filter(r=>!r.covered).reduce((n,r)=>n+r.lengthMm,0)
test('exact projection resolves a narrow antipad even when endpoints are covered',()=>{
 const shape={outer_ring:rect(0,0,10,10),inner_rings:[rect(4.99,4,.02,2)]}
 expect(uncovered(planeCoverageIntervals({x:1,y:5},{x:9,y:5},shape))).toBeCloseTo(.02,9)
 expect(uncovered(planeCoverageIntervals({x:9,y:5},{x:1,y:5},shape))).toBeCloseTo(.02,9)
})
test('outside edges, hole boundary and concave plane are not hidden by a bounding box',()=>{
 const shape={outer_ring:rect(0,0,10,10),inner_rings:[rect(4,4,2,2)]}
 expect(uncovered(planeCoverageIntervals({x:-1,y:2},{x:11,y:2},shape))).toBeCloseTo(2,9)
 expect(uncovered(planeCoverageIntervals({x:4,y:4},{x:6,y:4},shape))).toBeCloseTo(2,9)
 const concave={outer_ring:{vertices:[{x:0,y:0},{x:4,y:0},{x:4,y:1},{x:1,y:1},{x:1,y:4},{x:0,y:4}]},inner_rings:[]}
 expect(uncovered(planeCoverageIntervals({x:0,y:2},{x:4,y:2},concave))).toBeCloseTo(3,9)
 expect(()=>planeCoverageIntervals({x:NaN,y:0},{x:1,y:1},shape)).toThrow()
})