(name, got, want, tol)
| 956 | const dir = mkdtempSync(join(tmpdir(), 'cg-occ-')); |
| 957 | let n = 0, failures = 0; |
| 958 | const check = (name, got, want, tol) => { |
| 959 | n++; |
| 960 | const ok = Math.abs(got - want) <= tol; |
| 961 | if (!ok) failures++; |
| 962 | console.log(`${ok ? ' ok ' : ' FAIL'} ${name}: got ${Math.round(got)}, want ${want} ±${tol}`); |
| 963 | }; |
| 964 | // Builders for the event shapes Claude Code actually emits. |
| 965 | const req = (ctx, id, blocks) => blocks.map((b) => JSON.stringify({ |
| 966 | type: 'assistant', |