From 4cc19729c540ffba163d5c9a53b9352fe61fe8af Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 16 Jan 2014 17:28:37 -0600 Subject: in utils.c, make a version of get_timezone_name() that doesn't require a GSettings argument. Update utils tests. --- tests/state-fixture.h | 1 + tests/test-utils.cc | 79 ++++++++++++++++----------------------------------- 2 files changed, 25 insertions(+), 55 deletions(-) (limited to 'tests') diff --git a/tests/state-fixture.h b/tests/state-fixture.h index 0286ea9..3c6ecd5 100644 --- a/tests/state-fixture.h +++ b/tests/state-fixture.h @@ -50,6 +50,7 @@ protected: const DateTime now = DateTime::NowLocal(); m_clock.reset(new MockClock(now)); m_state.reset(new State); + m_state->settings.reset(new Settings); m_state->timezones.reset(new Timezones); m_state->clock = std::dynamic_pointer_cast(m_clock); m_state->planner.reset(new MockPlanner); diff --git a/tests/test-utils.cc b/tests/test-utils.cc index 8246396..2fe6a2e 100644 --- a/tests/test-utils.cc +++ b/tests/test-utils.cc @@ -17,22 +17,16 @@ * Charles Kerr */ -#include - -#include - -#include "utils.h" +#include -/*** -**** -***/ +#include TEST(UtilsTest, SplitSettingsLocation) { struct { - const char * location; - const char * expected_zone; - const char * expected_name; + const char* location; + const char* expected_zone; + const char* expected_name; } test_cases[] = { { "America/Chicago Chicago", "America/Chicago", "Chicago" }, { "America/Chicago Oklahoma City", "America/Chicago", "Oklahoma City" }, @@ -43,63 +37,38 @@ TEST(UtilsTest, SplitSettingsLocation) { "UTC UTC", "UTC", "UTC" } }; - for(guint i=0, n=G_N_ELEMENTS(test_cases); i