test: set case name from initial filename for a sequence

Port more incremental tests.
This commit is contained in:
Jakub Konka
2022-04-27 12:41:05 +02:00
parent 46db5e2a44
commit c1a98cd65d
28 changed files with 546 additions and 26 deletions

View File

@@ -0,0 +1,40 @@
const builtin = @import("builtin");
extern "c" fn write(usize, usize, usize) usize;
pub fn main() void {
var i: u32 = 0;
while (i < 4) : (i += 1) print();
assert(i == 4);
}
fn print() void {
switch (builtin.os.tag) {
.linux => {
asm volatile ("syscall"
:
: [number] "{rax}" (1),
[arg1] "{rdi}" (1),
[arg2] "{rsi}" (@ptrToInt("hello\n")),
[arg3] "{rdx}" (6),
: "rcx", "r11", "memory"
);
},
.macos => {
_ = write(1, @ptrToInt("hello\n"), 6);
},
else => unreachable,
}
}
pub fn assert(ok: bool) void {
if (!ok) unreachable; // assertion failure
}
// run
//
// hello
// hello
// hello
// hello
//