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/fixed-copper-refresh.test.ts

import {expect,test} from 'bun:test'
import {refreshFixedTraceRoute,fixedDdrLayer} from '../scripts/refresh-fixed-copper'
const wire=(x:number,y:number)=>({route_type:'wire',x,y,layer:'bottom',width:.08128})
const old={pcb_trace_id:'fixed_pcb_trace_0',connection_name:'rail',connectsTo:['token'],route:[wire(0,0),wire(1,.5)]}
test('refresh updates only interior geometry while retaining connectivity identity',()=>{
 const fresh={route:[wire(0,0),wire(.5,0),wire(1,.5)]}
 const updated=refreshFixedTraceRoute(old,fresh,false)
 expect(updated.route).toHaveLength(3)
 expect(updated.connection_name).toBe('rail')
 expect(updated.connectsTo).toEqual(['token'])
 expect(old.route).toHaveLength(2)
})
test('fixed physical six-layer mapping is explicit and rejects unknown layers',()=>{
 expect(fixedDdrLayer('inner3')).toBe('inner4')
 expect(fixedDdrLayer('inner4')).toBe('inner6')
 expect(fixedDdrLayer('bottom')).toBe('bottom')
 expect(()=>fixedDdrLayer('inner9')).toThrow()
})
test('refresh refuses moved terminals and changed wire widths',()=>{
 expect(()=>refreshFixedTraceRoute(old,{route:[wire(0,0),wire(1,.6)]},false)).toThrow()
 expect(()=>refreshFixedTraceRoute(old,{route:[wire(0,0),{...wire(.5,0),width:.1},wire(1,.5)]},false)).toThrow()
})