'use strict'; const assert=require('node:assert/strict'); const core=require('../engine.js'); const near=(a,b,eps=1e-6)=>assert.ok(Math.abs(a-b).02);assert.equal(x.allocationWarning,false); assert.ok(x.pValue>.05,'This modest effect is not detected at alpha=.05'); x=core.evaluate({nA:10000,kA:1000,nB:10000,kB:1300});assert.ok(x.pValue<.00001);assert.equal(x.detected,true); x=core.evaluate({nA:1000,kA:100,nB:2000,kB:230});assert.equal(x.allocationWarning,true); x=core.evaluate({nA:10,kA:0,nB:10,kB:0});assert.equal(x.pValue,1);assert.equal(x.sparse,true); let p=core.sampleSize(.06,.10,.05,.80);assert.ok(p.perArm>20000&&p.perArm<30000);assert.equal(p.total,2*p.perArm); assert.throws(()=>core.evaluate({nA:10,kA:11,nB:9,kB:3}));assert.throws(()=>core.sampleSize(.99,.5)); const sim1=core.simulate({nA:1000,kA:60,nB:1000,kB:80},100,202620); const sim2=core.simulate({nA:1000,kA:60,nB:1000,kB:80},100,202620); assert.deepEqual(sim1,sim2,'Same seed reproduces the same simulation');assert.equal(sim1.deltas.length,100); assert.ok(sim1.p05<=sim1.p50&&sim1.p50<=sim1.p95); console.log('PASS: 17 core statistical and reproducibility assertions');