52 lines
1.9 KiB
Diff
52 lines
1.9 KiB
Diff
From 8b4fe0ad32bac4da47188207541b0aec3f786498 Mon Sep 17 00:00:00 2001
|
|
From: Pierre Labastie <pierre.labastie@neuf.fr>
|
|
Date: Sun, 10 Apr 2022 22:24:47 +0200
|
|
Subject: [PATCH] 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
|
|
---
|
|
libgweather/tests/metar.c | 15 +++------------
|
|
1 file changed, 3 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/libgweather/tests/metar.c b/libgweather/tests/metar.c
|
|
index 7d6c7c04..a6fa7e79 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));
|
|
--
|
|
GitLab
|
|
|