summaryrefslogtreecommitdiff
path: root/anim/test/recordings.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 18:06:30 -0300
committerGabriel Schneider <[email protected]>2026-11-10 19:01:23 -0300
commite63b0624f57472d40af32a006c32cc47d403b822 (patch)
treeb7295da62acd96bc7aba425720eed95605526693 /anim/test/recordings.zig
parent318e16181a28725e218121363555580725d6d0d4 (diff)
downloadcomputeranim-e63b0624f57472d40af32a006c32cc47d403b822.tar.gz
computeranim-e63b0624f57472d40af32a006c32cc47d403b822.zip
canim: what the review found; the band as two panels; list and sort by instruction
The first videos were reviewed frame by frame and the catalogue changed with them. A lens is a drawing over the program column and its view over the state column, so the stack keeps six slots, its window on the whole frame. Operands are whole. list and sort are recorded by instruction from main (record --from), so their registers strike, links reach nodes and cells, rows that ran are marked and jumps are drawn. A call's node is a projection of its return address; pins travel and keep their side; a mark covers the bytes that changed, at the element's width; a syscall's result is stored after the kernel returns it and every panel is of one moment; fast passes are veiled; the clock stands still during a step; captions get their reading time and a scene's first step comes by four seconds. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Diffstat (limited to 'anim/test/recordings.zig')
-rw-r--r--anim/test/recordings.zig15
1 files changed, 9 insertions, 6 deletions
diff --git a/anim/test/recordings.zig b/anim/test/recordings.zig
index d853285..6d0577f 100644
--- a/anim/test/recordings.zig
+++ b/anim/test/recordings.zig
@@ -13,7 +13,8 @@ const expectEqual = std.testing.expectEqual;
test "steps by line stop on lines of the program's own source, and no step stands still" {
inline for (.{ recordings.steps, recordings.hello, recordings.sort, recordings.list }) |program| {
const rec = canim.open(program);
- var at = rec.call("main", 0).enter;
+ // From the first call it shows: main, or the one a recording begins in.
+ var at = rec.calls[0].enter;
var stops: usize = 0;
while (at < rec.end() and stops < 400) : (stops += 1) {
const next = rec.next(.line, at);
@@ -38,13 +39,13 @@ test "calls are a tree: fib(5) makes fifteen, each with what it was given and ga
for (nodes) |n| if (n.parent) |p| try expect(nodes[p].level + 1 == n.level);
}
-test "an instrumented program under the debugger tells its calls, variables and stores" {
+test "a program recorded by instruction, its variables told: calls, locals, and what they reach" {
const rec = canim.open(recordings.list);
var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);
defer arena.deinit();
const reverse = rec.call("reverse", 0);
try expectEqual(@as(usize, 3), rec.allocations.len);
- // The call begins where the debugger stopped on entering it: the line of its header, or its first.
+ // The recording begins in it (`--from reverse`): the call is open from the first stop.
try expect(rec.own[reverse.enter] == 17 or rec.own[reverse.enter] == 18);
// A local is not its value until its call has stored to it.
const first = rec.lineMoment(18, reverse.enter);
@@ -88,11 +89,13 @@ test "a walked step is as long as what it changed: fire, a slot a level, the hol
var frame: anim.Frame = .{ .t = 0, .clock = 0, .in = undefined, .pointer = .{ 0, 0 }, .arena = arena.allocator() };
scene.frame(&frame);
const t = canim.theme.time;
- // main's line calls fib(5): registers, the stack, the call. Three levels, 0.30 s apart.
+ // main's line calls fib(5): registers, the stack, the call, 0.30 s
+ // apart; the call's node when the projection from its way back arrives.
const from = rec.lineMoment(10, rec.call("main", 0).enter);
const call = scene.at.reading(from, rec.next(.line, from));
- try std.testing.expectApproxEqAbs(@as(f32, 3 * t.cascade), call.at[2], 1e-4);
- try expect(call.total > 2.0 and call.total < 3.0);
+ try std.testing.expectApproxEqAbs(@as(f32, 2 * t.cascade), call.at[1], 1e-4);
+ try std.testing.expectApproxEqAbs(@as(f32, 2 * t.cascade + t.project.bracket + t.project.far), call.at[2], 1e-4);
+ try expect(call.total > 2.0 and call.total < 3.5);
// A line that changes nothing shown: fire, advance, rest.
var quiet = scene.at;
quiet.levels = .{ .cpu = false, .memory = false };