From 9f867c71ee966733422d8436c6b47631d01c7dd7 Mon Sep 17 00:00:00 2001 From: cozis Date: Fri, 19 Jun 2026 13:02:16 +0200 Subject: [PATCH] examples: explicitly dump sometimes assertions report in example.zig --- examples/example.zig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/example.zig b/examples/example.zig index 738c874..224bf8c 100644 --- a/examples/example.zig +++ b/examples/example.zig @@ -5,9 +5,15 @@ const Simulator = @import("zigmulator"); fn programA(init: std.process.Init) anyerror!void { var stdout = Io.File.stdout().writerStreaming(init.io, &.{}); - for (0..3) |_| { + for (0..3) |i| { try stdout.interface.print("Hello from program A!\n", .{}); try stdout.interface.flush(); + + // Taken on the last iteration, so it shows up as taken (✓) in the report. + Simulator.assertSometimes(i == 2, @src(), "program A reached its last iteration"); + + // Never satisfied in this run, so it shows up as not-taken (✗). + Simulator.assertSometimes(i > 100, @src(), "program A looped more than 100 times"); } }