Some checks failed
check / check (push) Has been cancelled
First commit of the repo. Contents beyond the v0.1 simulator and layout: - Full Pico 2 W firmware (firmware/app, drivers, engine port, host test). - BANK page and 404 mode A/B removed; learned pads play exactly what was learned. - 404/MiniFreak renamed to KIT/SYNTH throughout (jacks, code, sim, docs, layout labels; wiring rebuilt). - ROLL returns to page select after a re-roll; a freshly learned track turns on. - LCD contrast 66. - ROOT and SCALE pages: 21 scales, AUTO = the seed picks; global and sticky. Intended music change: the scale table grew from 8 to 21 and AUTO picks from all of them, so every seed's scale changed. Vectors regenerated with npm run vectors, plus new key-override cases. Flash record is now version 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 lines
1.6 KiB
JavaScript
22 lines
1.6 KiB
JavaScript
/* Re-renders every golden case with sim/engine.js and compares with test/vectors.
|
|
Exit code 0 = engine unchanged. Use the same files to test the C port. */
|
|
var fs=require('fs'), path=require('path');
|
|
var E=require('../sim/engine.js'), R=require('./render.js');
|
|
var dir=path.join(__dirname,'vectors'), fail=0, n=0;
|
|
var prim=JSON.parse(fs.readFileSync(path.join(dir,'primitives.json'),'utf8'));
|
|
prim.mix.forEach(function(v){ n++; if(R.hex(E.mix(parseInt(v.a,16)>>>0,v.b))!==v.out){ fail++; console.log('mix',v.a,v.b,'differs'); } });
|
|
prim.rng.forEach(function(v){ n++; var r=new E.Rng(parseInt(v.seed,16)>>>0); for(var i=0;i<16;i++) if(R.hex(r.next())!==v.next[i]){ fail++; console.log('rng',v.seed,'step',i,'differs'); break; } });
|
|
prim.genomes.forEach(function(v){ n++; if(JSON.stringify(E.genome(parseInt(v.seed,16)>>>0))!==JSON.stringify(v.genome)){ fail++; console.log('genome',v.seed,'differs'); } });
|
|
fs.readdirSync(dir).filter(function(f){ return /^gen\d/.test(f); }).sort().forEach(function(f){
|
|
JSON.parse(fs.readFileSync(path.join(dir,f),'utf8')).cases.forEach(function(c){
|
|
n++;
|
|
var got=R.renderCase({seed:parseInt(c.seed,16)>>>0,salts:c.salts,gen:c.gen,energy:c.energy,drift:c.drift,fillBars:c.fillBars,scale:c.scale,root:c.root},c.bars.length);
|
|
if(got.checksum===c.checksum) return;
|
|
fail++;
|
|
for(var b=0;b<c.bars.length;b++){ var a=JSON.stringify(c.bars[b].events), g=JSON.stringify(got.bars[b].events);
|
|
if(a!==g){ console.log('FAIL',c.id,'first difference in bar',b); break; } }
|
|
});
|
|
});
|
|
console.log(fail? fail+' of '+n+' checks FAILED' : 'all '+n+' checks pass');
|
|
process.exit(fail?1:0);
|