Extend simulation runtime coverage and kinematics support
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { EventLog, ReplayTimeline, SnapshotStore, fnv1a64 } from "./replay.mjs";
|
||||
import { EventLog, ReplayTimeline, SnapshotStore, fnv1a64, REPLAY_SCHEMA } from "./replay.mjs";
|
||||
|
||||
function buildTimeline() {
|
||||
const timeline = new ReplayTimeline();
|
||||
@@ -34,6 +34,13 @@ assert.throws(() => {
|
||||
}, /snapshot_base_missing/);
|
||||
|
||||
const exported = first.export();
|
||||
assert.equal(exported.schema, REPLAY_SCHEMA);
|
||||
exported.snapshots.snapshots[0].state_hash = "fnv1a64:0000000000000000";
|
||||
assert.throws(() => new ReplayTimeline(exported), /snapshot_hash_mismatch/);
|
||||
assert.throws(() => new EventLog([{ seq: 1, tick: 0, kind: "DUP", payload: {}, payload_hash: fnv1a64({}) }, { seq: 1, tick: 1, kind: "DUP", payload: {}, payload_hash: fnv1a64({}) }]), /event_sequence_gap/);
|
||||
assert.throws(() => first.checkpoint(3, 8, { tick: 8 }), /checkpoint_cursor_mismatch/);
|
||||
assert.throws(() => first.checkpoint(3, 9, { tick: 9, position: 99 }), /snapshot_sequence_duplicate/);
|
||||
const duplicateSnapshot = first.export();
|
||||
duplicateSnapshot.snapshots.snapshots.push({ ...duplicateSnapshot.snapshots.snapshots[1] });
|
||||
assert.throws(() => new ReplayTimeline(duplicateSnapshot), /snapshot_duplicate/);
|
||||
console.log("replay=passed cursor=" + replay.cursor + " tick=" + replay.tick);
|
||||
|
||||
Reference in New Issue
Block a user