gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit289c6ce4289c6ce4HM1 report: heap object breakdownmre289c6ce4/plugins/time/tests/parity.mjs

1.9 KB

  1. // plugins/time/tests/parity.mjs — client.js (the browser half) against the native plugin.
  2. // node plugins/time/tests/parity.mjs
  3. // Runs parity.hl natively and the same calls through client.js in Node (Intl), and compares line
  4. // for line: the DST gap and fold of Europe/Vienna and America/New_York in 2026, and 1970.
  5. import { spawnSync } from 'node:child_process';
  6. import { readFileSync } from 'node:fs';
  7. import { dirname, join, resolve } from 'node:path';
  8. import { fileURLToPath } from 'node:url';
  9. const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '../../..');
  10. const BIN = process.env.HL_BIN || join(ROOT, 'native/zig-out/bin/hybriel');
  11. let failed = false;
  12. const ok = (c, m) => { if (!c) { failed = true; console.log('FAIL ' + m); } else console.log('ok ' + m); };
  13. ok(readFileSync(join(ROOT, 'plugins/time/client.js'), 'utf8') === readFileSync(join(ROOT, 'plugins/time/server.js'), 'utf8'), 'client.js is server.js, byte for byte (one implementation, two names)');
  14. const t = await import(join(ROOT, 'plugins/time/client.js'));
  15. const cases = [
  16. ['Europe/Vienna', 2026, 3, 29, 2, 30], ['Europe/Vienna', 2026, 10, 25, 2, 30],
  17. ['America/New_York', 2026, 3, 8, 2, 30], ['America/New_York', 2026, 11, 1, 1, 30],
  18. ['Europe/Vienna', 1970, 1, 1, 0, 0], ['America/New_York', 1970, 6, 1, 12, 0], ['Europe/Vienna', 2026, 7, 1, 12, 0],
  19. ];
  20. const mine = cases.map(([z, y, m, d, h, mi]) => {
  21. const ms = t.fromLocal({ year: y, month: m, day: d, hour: h, minute: mi }, z);
  22. return `${z} ${ms} ${t.offset(ms, z)} ${t.localTimestamp(ms, z)} ${t.timestamp(ms)} ${JSON.stringify(t.local(ms, z))} ${t.isZone(z)}`;
  23. });
  24. const r = spawnSync(BIN, [join(ROOT, 'plugins/time/tests/parity.hl')], { encoding: 'utf8' });
  25. const native = r.stdout.trim().split('\n');
  26. ok(r.status === 0 && native.length === mine.length, 'native run answered ' + mine.length + ' lines');
  27. mine.forEach((l, i) => ok(l === native[i], l.slice(0, 60) + (l === native[i] ? '' : '\n native: ' + native[i] + '\n client: ' + l)));
  28. process.exit(failed ? 1 : 0);

Branches

Latest commits

  • 289c6ce4HM1 report: heap object breakdownmre
  • 2e7d6257log: HM1 startedmre
  • 2f790465mission HM1: heap object breakdownmre
  • a18957falog: evening re-measure after CBmre
  • aac9a98dlog: evening re-measure startmre
  • 45163bd4log: person/tmdb error hypothesismre
  • cb38de2blog: swap 503 causemre
  • fd10c3d5log: CB livemre
  • 7557c025log: CB deploy try 2mre
  • 06a7534aMerge branch 'cb'mre
  • 2f8030d6log: CB gates greenmre
  • 498bf644log: CB gates startmre
  • f59c2847gc1: bound the five request caches (shows.hl cacheLimit)mre
  • 6ea2c6d6log: morning re-measure 11-04mre
  • 446290f0log: GC1 livemre
  • 8e6aa91dlog: GC1 deploy retrymre
  • 87ad2dc1log: GC1 deployingmre
  • 53f10fb8Merge branch 'gc1-deploy'mre
  • 7fcbf1d2log: GC1 deploy GOmre
  • 1fb6664bcompose: TRACKER_QSTATS=1 (GC1 measurement)mre