summaryrefslogtreecommitdiff
path: root/anim/test
diff options
context:
space:
mode:
Diffstat (limited to 'anim/test')
-rw-r--r--anim/test/gallery/atoms.pngbin96800 -> 99949 bytes
-rw-r--r--anim/test/gallery/none.pngbin219668 -> 223411 bytes
-rw-r--r--anim/test/gallery/rest.pngbin229667 -> 230803 bytes
-rw-r--r--anim/test/gallery/rows.pngbin105675 -> 106864 bytes
-rw-r--r--anim/test/gallery/step.pngbin229198 -> 230313 bytes
-rw-r--r--anim/test/gallery/subject.pngbin205715 -> 204289 bytes
-rw-r--r--anim/test/recordings.zig15
7 files changed, 9 insertions, 6 deletions
diff --git a/anim/test/gallery/atoms.png b/anim/test/gallery/atoms.png
index 7458689..025176c 100644
--- a/anim/test/gallery/atoms.png
+++ b/anim/test/gallery/atoms.png
Binary files differ
diff --git a/anim/test/gallery/none.png b/anim/test/gallery/none.png
index 8116b10..098b50a 100644
--- a/anim/test/gallery/none.png
+++ b/anim/test/gallery/none.png
Binary files differ
diff --git a/anim/test/gallery/rest.png b/anim/test/gallery/rest.png
index fa7ee53..92c50ab 100644
--- a/anim/test/gallery/rest.png
+++ b/anim/test/gallery/rest.png
Binary files differ
diff --git a/anim/test/gallery/rows.png b/anim/test/gallery/rows.png
index 97a8fd9..9f6c095 100644
--- a/anim/test/gallery/rows.png
+++ b/anim/test/gallery/rows.png
Binary files differ
diff --git a/anim/test/gallery/step.png b/anim/test/gallery/step.png
index 9678e91..1ca6f8a 100644
--- a/anim/test/gallery/step.png
+++ b/anim/test/gallery/step.png
Binary files differ
diff --git a/anim/test/gallery/subject.png b/anim/test/gallery/subject.png
index e7f10ef..b579083 100644
--- a/anim/test/gallery/subject.png
+++ b/anim/test/gallery/subject.png
Binary files differ
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 };