From fa7e21b78382fe1fb783a00a12f1575e145e2f3b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 7 May 2017 13:40:43 +0200 Subject: [PATCH] very simple calendar test. --- src/calendar.test.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/calendar.test.c b/src/calendar.test.c index e8df8cd58..488db3bfe 100644 --- a/src/calendar.test.c +++ b/src/calendar.test.c @@ -7,19 +7,49 @@ #include #include "tests.h" +static void test_calendar_config(CuTest * tc) +{ + gamedate gd; + + test_setup(); + get_gamedate(0, &gd); + CuAssertIntEquals(tc, 0, first_turn()); + config_set_int("game.start", 42); + CuAssertIntEquals(tc, 42, first_turn()); + test_cleanup(); +} + static void test_calendar(CuTest * tc) { gamedate gd; test_setup(); get_gamedate(0, &gd); + CuAssertIntEquals(tc, 1, gd.year); + CuAssertIntEquals(tc, 0, gd.season); CuAssertIntEquals(tc, 0, gd.month); + CuAssertIntEquals(tc, 0, gd.week); + + get_gamedate(1, &gd); + CuAssertIntEquals(tc, 1, gd.year); + CuAssertIntEquals(tc, 0, gd.season); + CuAssertIntEquals(tc, 0, gd.month); + CuAssertIntEquals(tc, 1, gd.week); + + config_set_int("game.start", 42); + get_gamedate(42, &gd); + CuAssertIntEquals(tc, 1, gd.year); + CuAssertIntEquals(tc, 0, gd.season); + CuAssertIntEquals(tc, 0, gd.month); + CuAssertIntEquals(tc, 0, gd.week); + test_cleanup(); } CuSuite *get_calendar_suite(void) { CuSuite *suite = CuSuiteNew(); + SUITE_ADD_TEST(suite, test_calendar_config); SUITE_ADD_TEST(suite, test_calendar); return suite; }