It seems a lot has changed recently, wanted to check out some of my old “test” projects, now it seems every addExectuable, addTest needs to have a “root_module”, well it kinda makes sense, but on windows normal test are required to link advapi32 manually, is that intentional?
Will the test part change too in future? Because manually doing exe_tests.linkSystemLibrary("advapi32"); everytime for normal tests to be able to compile, kinda feels extra work? Just my opinion.
Ow actually my bad in one of my test case I was using std.crypto.random which probably references std.os.windows.RtlGenRandom eventually, just noticed std.testing doesn’t expose any kind of random scalar value getter? Just not familiar with fuzzing. I just needed a random u8 value.
You likely don’t need/want cryptographically secure RNG for your test cases, especially if you’re doing fuzzing, as you want your results to be fully reproducible from the input. PRNG from std.Random is likely a better choice:
test "foo" {
// You can use std.testing.random_seed if you want the test
// runner-provided seed (this seed is printed when the test fails).
// For fuzzing, you might want to use part of the input to derive the seed,
// but I've not used the built-in fuzzing enough to give advice on that.
var prng = std.Random.DefaultPrng.init(std.testing.random_seed);
const random = prng.random();
const random_u8 = random.int(u8);
// ...
}