(title, fields, unit, scale = 1)
| 10 | |
| 11 | const fmt = (v, u) => v >= 100 ? v.toFixed(0) + u : v >= 1 ? v.toFixed(2) + u : v.toFixed(3) + u; |
| 12 | function table(title, fields, unit, scale = 1) { |
| 13 | console.log(`\n${title}`); |
| 14 | console.log(' field'.padEnd(22) + ['n', 'mean', 'p50', 'p90', 'max'].map(h => h.padStart(9)).join('')); |
| 15 | for (const f of fields) { |
| 16 | const s = stats(collectors[f]); |
| 17 | if (!s) continue; |
| 18 | console.log(` ${ f.padEnd(20) }${String(s.n).padStart(9) |
| 19 | }${[s.mean, s.p50, s.p90, s.max].map(v => fmt(v * scale, unit).padStart(9)).join('')}`); |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | console.log(`SunCalc validation vs external truth (fixtures generated ${fx.generated})`); |
| 24 | table('Sun position (deg vs JPL Horizons, refracted)', ['sun.altitude', 'sun.azimuth', 'sun.angularSep'], '°'); |
no test coverage detected
searching dependent graphs…