}
static void
-dump_seed(void)
+write_stochastic_warning(void)
{
- printf("\n"
+ if (tinytest_cur_test_has_failed()) {
+ printf("\n"
"NOTE: This is a stochastic test, and we expect it to fail from\n"
"time to time, with some low probability. If you see it fail more\n"
"than one trial in 100, though, please tell us.\n\n");
- testing_dump_reproducible_rng_seed();
+ }
}
static void
done:
if (tests_failed) {
- dump_seed();
+ write_stochastic_warning();
}
testing_disable_reproducible_rng();
}
done:
if (tests_failed) {
- dump_seed();
+ write_stochastic_warning();
}
testing_disable_reproducible_rng();
}
done:
if (tests_failed) {
- dump_seed();
+ write_stochastic_warning();
}
testing_disable_reproducible_rng();
}
done:
if (tests_failed) {
- dump_seed();
+ write_stochastic_warning();
}
testing_disable_reproducible_rng();
}
test_stochastic_log_logistic(void *arg)
{
bool ok = 0;
- bool tests_failed = true;
(void) arg;
testing_enable_reproducible_rng();
ok = test_stochastic_log_logistic_impl(exp(-10), 1e-2);
tt_assert(ok);
- tests_failed = false;
-
done:
- if (tests_failed) {
- dump_seed();
- }
+ write_stochastic_warning();
testing_disable_reproducible_rng();
}
test_stochastic_weibull(void *arg)
{
bool ok = 0;
- bool tests_failed = true;
(void) arg;
testing_enable_reproducible_rng();
ok = test_stochastic_weibull_impl(10, 1);
tt_assert(ok);
- tests_failed = false;
-
done:
- if (tests_failed) {
- dump_seed();
- }
+ write_stochastic_warning();
testing_disable_reproducible_rng();
UNMOCK(crypto_rand);
}