ReviewOS

also looking at this

zig-utils/zig-test-framework

Add reproducible randomized test order

#29
Merged glennmichael123 wants to merge codex/issue-14-random-order into main
18 files +487 -42
src/config.zigmodified+6-0
Changes to src/config.zig
@@ -32,6 +32,8 @@ pub const TestOptions = struct {
3232 retries: usize = 0,
3333 repeat: usize = 1,
3434 fail_on_flaky: bool = false,
35 shuffle: bool = false,
36 seed: ?u64 = null,
3537};
3638
3739pub const ParallelOptions = struct {
@@ -207,6 +209,8 @@ test "TestConfig defaults match CLI discovery defaults" {
207209 try std.testing.expectEqual(@as(usize, 0), config.test_options.retries);
208210 try std.testing.expectEqual(@as(usize, 1), config.test_options.repeat);
209211 try std.testing.expect(!config.test_options.fail_on_flaky);
212 try std.testing.expect(!config.test_options.shuffle);
213 try std.testing.expect(config.test_options.seed == null);
210214 try std.testing.expect(config.sharding.index == null);
211215 try std.testing.expect(config.sharding.count == null);
212216 try std.testing.expect(!config.parallel.enabled);
@@ -247,6 +251,8 @@ test "ConfigLoader loads supported JSON and rejects unknown keys" {
247251 try std.testing.expectEqual(@as(usize, 1), config.test_options.retries);
248252 try std.testing.expectEqual(@as(usize, 2), config.test_options.repeat);
249253 try std.testing.expect(!config.test_options.fail_on_flaky);
254 try std.testing.expect(config.test_options.shuffle);
255 try std.testing.expectEqual(@as(?u64, 42), config.test_options.seed);
250256 try std.testing.expectEqual(@as(?usize, 1), config.sharding.index);
251257 try std.testing.expectEqual(@as(?usize, 1), config.sharding.count);
252258