diff options
author | Pierre Labastie <pierre.labastie@neuf.fr> | 2022-04-10 22:24:47 +0200 |
---|---|---|
committer | Pierre Labastie <pierre.labastie@neuf.fr> | 2022-04-26 17:51:10 +0200 |
commit | 8b4fe0ad32bac4da47188207541b0aec3f786498 (patch) | |
tree | bcf7e9d7c19c91037d83fce6ff69539d1817e616 | |
parent | 641207aebadfc917806d93fc23aceffcefea79be (diff) | |
download | libgweather-8b4fe0ad32bac4da47188207541b0aec3f786498.tar.gz |
metar test: Don't use "known" duplicates
The metar list provided by NOAA contains duplicate ICAO codes.
Those duplicates may change over time, so it does not make sense
to use an array of known duplicates. Presently a duplicate is rejected
when it is known, and inserted if it is not, leading to a difference
in the number of insertions and the number of keys, so that the test
fails. If any duplicate is rejected, the number of insertions is
always equal to the number of keys (unless something goes wrong
in g_hash_table_insert). And this is the default behavior for known
duplicates anyway.
Closes: https://gitlab.gnome.org/GNOME/libgweather/-/issues/168
-rw-r--r-- | libgweather/tests/metar.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/libgweather/tests/metar.c b/libgweather/tests/metar.c index 7d6c7c0..a6fa7e7 100644 --- a/libgweather/tests/metar.c +++ b/libgweather/tests/metar.c @@ -41,20 +41,11 @@ parse_metar_stations (const char *contents) continue; } + /* If it is a duplicate discard it */ if (g_hash_table_lookup (stations_ht, station)) { - const char * const known_duplicates[] = { - "VOGO", - "KHQG", - "KOEL", - "KTQK", - "KX26", - NULL - }; - if (g_strv_contains (known_duplicates, station)) { - g_free (station); - continue; - } g_test_message ("Weather station '%s' already defined\n", station); + g_free (station); + continue; } g_hash_table_insert (stations_ht, station, g_strdup (line)); |