diff options
author | Bastien Nocera <hadess@hadess.net> | 2018-03-08 13:03:30 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2018-03-09 12:10:37 +0100 |
commit | 157d2dcae0b0b30632caa6c575715f43806f7414 (patch) | |
tree | 0121aeae8e258cc6aa32d3c55fe9a2fd5777d5ed | |
parent | cc7384f30aa75b1023e67efa778df6fd11a4fad3 (diff) | |
download | libgweather-157d2dcae0b0b30632caa6c575715f43806f7414.tar.gz |
tests: Rename "bad" duplicate weather station test
Rename the test as it's checking whether weather stations are badly
duplicated, not whether they're unique in the state or country.
Duplicate weather stations are allowed across state and country borders.
https://bugzilla.gnome.org/show_bug.cgi?id=792328
-rw-r--r-- | libgweather/test_libgweather.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/libgweather/test_libgweather.c b/libgweather/test_libgweather.c index 5342d35..4b56cb3 100644 --- a/libgweather/test_libgweather.c +++ b/libgweather/test_libgweather.c @@ -292,9 +292,9 @@ test_metar_weather_stations (void) } static void -check_duplicate_weather_stations (gpointer key, - gpointer value, - gpointer user_data) +check_bad_duplicate_weather_stations (gpointer key, + gpointer value, + gpointer user_data) { GPtrArray *stations = value; GHashTable *dedup; @@ -327,8 +327,8 @@ out: } static void -test_duplicate_weather_stations_children (GWeatherLocation *location, - GHashTable *stations_ht) +test_bad_duplicate_weather_stations_children (GWeatherLocation *location, + GHashTable *stations_ht) { GWeatherLocation **children; guint i; @@ -347,25 +347,26 @@ test_duplicate_weather_stations_children (GWeatherLocation *location, g_ptr_array_add (stations, children[i]); g_hash_table_insert (stations_ht, g_strdup (code), stations); } else { - test_duplicate_weather_stations_children (children[i], stations_ht); + test_bad_duplicate_weather_stations_children (children[i], stations_ht); } } } static void -test_duplicate_weather_stations (void) +test_bad_duplicate_weather_stations (void) { GWeatherLocation *world; GHashTable *stations_ht; + g_setenv ("LIBGWEATHER_LOCATIONS_NO_NEAREST", "1", TRUE); world = gweather_location_get_world (); g_assert (world); stations_ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) NULL); - test_duplicate_weather_stations_children (world, stations_ht); + test_bad_duplicate_weather_stations_children (world, stations_ht); - g_hash_table_foreach (stations_ht, check_duplicate_weather_stations, NULL); + g_hash_table_foreach (stations_ht, check_bad_duplicate_weather_stations, NULL); } static void @@ -393,7 +394,8 @@ main (int argc, char *argv[]) g_test_add_func ("/weather/timezones", test_timezones); g_test_add_func ("/weather/airport_distance_sanity", test_airport_distance_sanity); g_test_add_func ("/weather/metar_weather_stations", test_metar_weather_stations); - g_test_add_func ("/weather/duplicate_weather_stations", test_duplicate_weather_stations); + /* Modifies environment, so needs to run last */ + g_test_add_func ("/weather/bad_duplicate_weather_stations", test_bad_duplicate_weather_stations); return g_test_run (); } |