diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 06:10:20 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | 8dc369f343fda8f54756376728f4690386c20a69 (patch) | |
| tree | 984ee97d6645c99a26a710a7bc343c441e6f3631 /examples/live/test/live.script | |
| parent | a4d1e3131499c17bd6f73e65154aa0c2b31c62b3 (diff) | |
| download | sketchbook-8dc369f343fda8f54756376728f4690386c20a69.tar.gz sketchbook-8dc369f343fda8f54756376728f4690386c20a69.zip | |
examples/live: the scripted proof, a session played back and sought
test/live.script now ends with the run's own session replayed: `play
session 0` from its start, then `seek` to the two moments marked as they
happened (the gradient just typed, and the end after an edit, a broken
line and its mend). At each, the State equals the mark leaf by leaf
(`expect-snapshot`: the text, both tapes, the problem, the time), and at
the first the screenshot equals the live one over the text and the
picture (0,0 1000x600, without the scope and the status line). `stop`
then goes on live from that moment: the typed program, before its edit.
What a script could not do: a `record` clip ends at the first mark
(Console.zig's `save` stops it), so the clip cannot be marked while it
is made: the session is replayed instead. A mark is State before its
frame's tick, so its time is the printed time less a frame, and `seek
MS` lands on the last frame at or before MS: the script seeks 5 ms past
each mark's time (272 and 488).
The sound at a jump: `want` counted the queue the clear is about to
drop, so a seek starved the device for a frame; now it counts from
empty. And the block after a jump crosses from the old tape at where the
device was (the clock less what was queued) to the tape at the new time
(Synth.old_start). Not measured: a capture records every block made,
including the tail the jump drops, so it cannot show what was heard
across a seek.
zig build test: 68 of 68 steps, 6 of 6 tests.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'examples/live/test/live.script')
| -rw-r--r-- | examples/live/test/live.script | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/examples/live/test/live.script b/examples/live/test/live.script index 22085bf..695d16a 100644 --- a/examples/live/test/live.script +++ b/examples/live/test/live.script @@ -1,4 +1,6 @@ -# A program typed, its tapes after each line, a broken line and its mend. +# A program typed, its tapes after each line, a broken line and its mend; +# then this run's session played back, and sought to two moments marked as +# they happened. (A mark ends a clip, `record`, so the session is replayed.) # Screenshots land in .zig-cache/live/ for review; they are compared over # the picture alone (640,300 600x300: not the text, the scope or the time). frames 2 @@ -16,6 +18,7 @@ expect color.len 4 expect color.code[0].op x expect color.code[3].op hsv frames 2 +console save typed screenshot .zig-cache/live/gradient.png # An edit: y becomes x, and the picture changes. key backspace @@ -39,3 +42,20 @@ expect-same-screenshot .zig-cache/live/edited.png .zig-cache/live/broken.png 0 6 type ) expect problem.len 0 expect color.len 3 +console save end +# Played back from the start, then sought: each moment's text, tapes and +# time as they were live, leaf by leaf (a mark is taken before its frame's +# tick: 0.2667 s and 0.4833 s; a seek lands on the last frame at or before). +console play session 0 +frames 100 +console seek 488 +expect-snapshot end +console seek 272 +expect-snapshot typed +expect color.len 4 +screenshot .zig-cache/live/sought.png +expect-same-screenshot .zig-cache/live/gradient.png .zig-cache/live/sought.png 0 0 0 1000 600 +# Live again from there: the typed program, before its edit. +console stop +expect len 53 +expect color.code[3].op hsv |
