mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-15 15:41:26 -07:00
Support deterministic random seeding of tests
Add a new option `ODIN_TEST_RANDOM_SEED` which is picked from the cycle counter at startup, if it's not specified by the user. This number is sent to every test in the `T` struct and reset every test (just in case).
This commit is contained in:
@@ -29,6 +29,16 @@ Internal_Cleanup :: struct {
|
||||
T :: struct {
|
||||
error_count: int,
|
||||
|
||||
// If your test needs to perform random operations, it's advised to use
|
||||
// this value to seed a local random number generator rather than relying
|
||||
// on the non-thread-safe global one.
|
||||
//
|
||||
// This way, your results will be deterministic.
|
||||
//
|
||||
// This value is chosen at startup of the test runner, logged, and may be
|
||||
// specified by the user. It is the same for all tests of a single run.
|
||||
seed: u64,
|
||||
|
||||
channel: Update_Channel_Sender,
|
||||
|
||||
cleanups: [dynamic]Internal_Cleanup,
|
||||
|
||||
Reference in New Issue
Block a user