diff options
Diffstat (limited to 'test/replicas.zig')
| -rw-r--r-- | test/replicas.zig | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/test/replicas.zig b/test/replicas.zig index 90f7c10d..a68ce222 100644 --- a/test/replicas.zig +++ b/test/replicas.zig @@ -856,19 +856,18 @@ const Watchdog = struct { /// the untraced one. const Named = struct { const Parted = struct { c: usize, origin: u16, seq: u32, parts: []u64, terms: [pardes.MAX_PANES]Term }; - /// A terminal pane's: its screen's digest without its view and with - /// it, and where its view and cursor stand. - const Term = struct { content: u64 = 0, viewed: u64 = 0, grid: pardes.Term.Grid = .{} }; + /// A terminal pane's: its screen's digest, where the live view stands + /// in it (the pane's, `scrolled_to`), and its grid. + const Term = struct { content: u64 = 0, place: ?usize = null, grid: pardes.Term.Grid = .{} }; fn terms(p: *const pardes.Pardes) [pardes.MAX_PANES]Term { var out: [pardes.MAX_PANES]Term = @splat(.{}); for (p.panes, &out) |slot, *t| { - const state = (slot orelse continue).terminal orelse continue; + const pane = slot orelse continue; + const state = pane.terminal orelse continue; var a = pardes.walk.Hasher.init(0); - state.digestScreen(&a, false); - var b = pardes.walk.Hasher.init(0); - state.digestScreen(&b, true); - t.* = .{ .content = a.final(), .viewed = b.final(), .grid = pardes.Term.grid(state) }; + state.digest(&a); + t.* = .{ .content = a.final(), .place = pane.scrolled_to, .grid = pardes.Term.grid(state) }; } return out; } @@ -898,8 +897,8 @@ const Named = struct { const theirs = arena.allocator().create(pardes.tape.Parts) catch return; const want = pardes.tape.digestParts(rp.core(), theirs); w.print("seed {d} rtt {d} ms: client {d} names: at unit {d}/{d}, against the witness's replay: {s}\n", tag ++ .{ x.c + 1, u.origin, u.seq, pardes.tape.partsDiffer(x.parts, want, arena.allocator()) }) catch {}; - for (x.terms, terms(rp.core()), 0..) |a, b, id| if (a.viewed != b.viewed or a.content != b.content) { - w.print(" pane {d}'s terminal: content {s}, view {s}; the client's {any}; the witness's {any}\n", .{ id, if (a.content == b.content) "equal" else "DIFFERS", if (a.viewed == b.viewed) "equal" else "DIFFERS", a.grid, b.grid }) catch {}; + for (x.terms, terms(rp.core()), 0..) |a, b, id| if (a.place != b.place or a.content != b.content) { + w.print(" pane {d}'s terminal: content {s}, view {s}; the client's {any} at {?d}; the witness's {any} at {?d}\n", .{ id, if (a.content == b.content) "equal" else "DIFFERS", if (a.place == b.place) "equal" else "DIFFERS", a.grid, a.place, b.grid, b.place }) catch {}; }; }; } |
