From 6260a45be5611712a6a6647013c6e7eb980a734a Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 24 May 2015 11:32:16 +0200 Subject: [PATCH] running the test 1000 times should not change the result. if it does, that is because it depends on state (of the random number generator), which is bad and needs to be fixed if it makes the test intermittent. --- src/laws.test.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/laws.test.c b/src/laws.test.c index ebc23f921..d40724db7 100644 --- a/src/laws.test.c +++ b/src/laws.test.c @@ -696,12 +696,11 @@ static void test_reserve_self(CuTest *tc) { static void statistic_test(CuTest *tc, int peasants, int luck, int maxp, double variance, int min_value, int max_value) { - int effect, i; - for (i = 0; i < 1000; ++i) { - effect = peasant_luck_effect(peasants, luck, maxp, variance); - CuAssertTrue(tc, min_value <= effect); - CuAssertTrue(tc, max_value >= effect); - } + int effect; + + effect = peasant_luck_effect(peasants, luck, maxp, variance); + CuAssertTrue(tc, min_value <= effect); + CuAssertTrue(tc, max_value >= effect); } static void test_peasant_luck_effect(CuTest *tc) { @@ -780,7 +779,7 @@ CuSuite *get_laws_suite(void) SUITE_ADD_TEST(suite, test_force_leave_buildings); SUITE_ADD_TEST(suite, test_force_leave_ships); SUITE_ADD_TEST(suite, test_force_leave_ships_on_ocean); - DISABLE_TEST(suite, test_peasant_luck_effect); + SUITE_ADD_TEST(suite, test_peasant_luck_effect); SUITE_ADD_TEST(suite, test_luck_message); return suite;