跳转到内容
查看源码

回放测试指令自动生成

.replay 测试文件的每一种行。

名称 类别 写法
alike alike
allow allow file.write <dir> | allow file.delete <dir>
button button <name> down | up
clipboard clipboard "<text>"
expect expect <x> <y> = <r> <g> <b> [<tolerance>]
expect expect <node.port[i][.field]> = <value>... [<tolerance>]
expect expect <node.port[i][.field]> < | <= | > | >= <number>...
expect expect count <node.port> = <n>
expect expect placed <node> main | ordered
frame frame <seconds> [to <seconds> every <seconds>]
key key <code> down | up
library library <path>
pads pads <count>
param param <name> <literal>
pointer pointer [<x> <y>] [down | up]
reset reset [<node.port>]
scene scene <path>
settle settle
show show <node.port[i][.field]>
stick stick left | right | triggers <x> <y>
type type "<text>"
wheel wheel <x> <y>
window window <w> <h> [<scale>]
alike

its checks hold two forms of one computation equal word for word, which they are only where every Kernel rounds alike, so --round-apart leaves the replay out

示例

alike

allow file.write <dir> | allow file.delete <dir>

lets the scene’s outputs write (or remove and rename) files under the directory, relative to the replay file, as --allow does; what they write is kept for the run and never reaches the disk, so every run starts from the same files; with or without it, what the scene saved for itself before the run (an output’s file an input reads, with a fallback) is not read until the run writes it

示例

allow file.write ../laws/

button <name> down | up

left, right, middle, or a pad’s south, east, west, north, l1, r1, l3, r3, start, select

示例

button right down
button south up

clipboard "<text>"

the clipboard holding this text from here on, as a person copying elsewhere leaves it: what an input = clipboard reads; the same escapes as type

示例

clipboard "from elsewhere"

expect <x> <y> = <r> <g> <b> [<tolerance>]

the picture’s color at x y from its top left, each channel 0 to 1 as the Kernel wrote it; tolerance 0.01 when not given

示例

expect 11 10 = 1.0 1.0 1.0
expect 11 10 = 1.0 1.0 1.0 0.05

expect <node.port[i][.field]> = <value>... [<tolerance>]

an element of a node’s output, or a field of it (a struct’s element is compared a field at a time; an array’s element is named by its index, .cells.2): ints and bools exactly, floats and vectors within the tolerance; i counts along the Field, x fastest, then y, then z

示例

expect step.result[0].score = 1
expect step.result[0].cells.2 = 0

expect <node.port[i][.field]> < | <= | > | >= <number>...

every component of it past a bound

示例

expect fall.result[0].speed > 2.5

expect count <node.port> = <n>

how many elements a node’s output holds

示例

expect count ground.result = 6889

expect placed <node> main | ordered

where a node runs: the session’s main backend, or ordered work off it; a session with one backend reads both as main

示例

expect placed ring main
expect placed filter ordered

frame <seconds> [to <seconds> every <seconds>]

evaluates one frame at this session time; with to and every, a frame at each step from the first time to the last, both included

示例

frame 0.0
frame 0.1 to 2.0 every 0.1

key <code> down | up

a key by the browser’s code, as key() reads it: letters and digits by uppercase ASCII, space 32, enter 13, arrows 37 to 40, the rest in help key

示例

key 67 down

library <path>

Kernels beyond the scene’s use

示例

library ../kernels/

pads <count>

how many pads are connected from here on, what pads() reads

示例

pads 1

param <name> <literal>

sets a graph parameter

示例

param exposure 1.5

pointer [<x> <y>] [down | up]

moves the pointer, in the output’s pixels from its top left (what pointer() reads), and presses or releases it

示例

pointer 20 20 down
pointer up

reset [<node.port>]

forgets every node’s committed state, or one port’s

示例

reset
reset step.result

scene <path>

the scene to test, relative to the replay file; required

示例

scene ../scene.esn

settle

waits for every async run to land

示例

settle

show <node.port[i][.field]>

prints an element of a node’s output after the last frame, or a field of it, a struct field by field; it checks nothing, and the run reports what it shows

示例

show step.result[0]
show step.result[0].score

stick left | right | triggers <x> <y>

a pad’s axis pair

示例

stick left 0.5 -1

type "<text>"

characters typed, what typed() reads on the next frame (32 a frame, the rest on the frames after); \", \\, \n and \t inside the quotes, # among them no comment

示例

type "你好, Quill"

wheel <x> <y>

the scroll for the next frame only

示例

wheel 0 -1

window <w> <h> [<scale>]

the window in pixels, for window(), and its scale factor; one when not given

示例

window 240 135
window 240 135 0.25