diff options
-rw-r--r-- | libgweather/meson.build | 57 | ||||
-rw-r--r-- | libgweather/tests/meson.build | 15 | ||||
-rw-r--r-- | libgweather/tests/test_libgweather.c (renamed from libgweather/test_libgweather.c) | 25 | ||||
-rw-r--r-- | libgweather/tools/meson.build | 40 | ||||
-rw-r--r-- | libgweather/tools/test_locations.c (renamed from libgweather/test_locations.c) | 10 | ||||
-rw-r--r-- | libgweather/tools/test_locations_utc.c (renamed from libgweather/test_locations_utc.c) | 12 | ||||
-rw-r--r-- | libgweather/tools/test_metar.c (renamed from libgweather/test_metar.c) | 0 | ||||
-rw-r--r-- | libgweather/tools/test_sun_moon.c (renamed from libgweather/test_sun_moon.c) | 0 | ||||
-rw-r--r-- | libgweather/tools/test_weather.c (renamed from libgweather/test_weather.c) | 0 |
9 files changed, 82 insertions, 77 deletions
diff --git a/libgweather/meson.build b/libgweather/meson.build index 0dbf41b..6851867 100644 --- a/libgweather/meson.build +++ b/libgweather/meson.build @@ -156,7 +156,10 @@ libgweather_static = static_library('gweather', ) libgweather_static_dep = declare_dependency(sources: gweather_c_sources, - include_directories: include_directories('..'), + include_directories: [ + include_directories('.'), + include_directories('..'), + ], dependencies: deps_libgweather, link_with: libgweather_static, ) @@ -210,53 +213,5 @@ if enable_vala ) endif -test_cargs = [ - '-DTEST_LOCATIONS="@0@"'.format(locations_bin.full_path()), - '-DSCHEMASDIR="@0@/schemas"'.format(meson.source_root()), - '-DSCHEMAS_BUILDDIR="@0@/schemas"'.format(meson.build_root()), -] - -executable('test_locations', - sources: ['test_locations.c'], - c_args: test_cargs, - dependencies: libgweather_static_dep, - install: false, -) - -executable('test_locations_utc', - sources: ['test_locations_utc.c'], - c_args: test_cargs, - dependencies: libgweather_static_dep, - install: false, -) - -test('test_libgweather', - executable('test_libgweather', - sources: ['test_libgweather.c'], - c_args: test_cargs, - dependencies: libgweather_static_dep, - install: false, - ), - depends: [locations_bin], -) - -executable('test_metar', - sources: ['test_metar.c', gweather_c_sources, gweather_priv_sources], - c_args: test_cargs, - dependencies: libgweather_static_dep, - install: false, -) - -executable('test_sun_moon', - sources: ['test_sun_moon.c', 'weather-sun.c', 'weather-moon.c'], - c_args: test_cargs, - dependencies: libgweather_static_dep, - install: false, -) - -executable('test_weather', - sources: ['test_weather.c'], - c_args: test_cargs, - dependencies: libgweather_static_dep, - install: false, -) +subdir('tests') +subdir('tools') diff --git a/libgweather/tests/meson.build b/libgweather/tests/meson.build new file mode 100644 index 0000000..201fd39 --- /dev/null +++ b/libgweather/tests/meson.build @@ -0,0 +1,15 @@ +test_cargs = [ + '-DTEST_LOCATIONS="@0@"'.format(locations_bin.full_path()), + '-DSCHEMASDIR="@0@/schemas"'.format(meson.source_root()), + '-DSCHEMAS_BUILDDIR="@0@/schemas"'.format(meson.build_root()), +] + +test('test_libgweather', + executable('test_libgweather', + sources: ['test_libgweather.c'], + c_args: test_cargs, + dependencies: libgweather_static_dep, + install: false, + ), + depends: [locations_bin], +) diff --git a/libgweather/test_libgweather.c b/libgweather/tests/test_libgweather.c index 1a710fe..d00159d 100644 --- a/libgweather/test_libgweather.c +++ b/libgweather/tests/test_libgweather.c @@ -1,20 +1,7 @@ -/* - * (c) 2017 Bastien Nocera <hadess@hadess.net> +/* test_libgweather.c: Test suite for libgweather * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. + * SPDX-FileCopyrightText: 2017 Bastien Nocera <hadess@hadess.net> + * SPDX-License-Identifier: LGPL-2.0-or-later */ #include "config.h" @@ -23,9 +10,9 @@ #include <string.h> #include <libsoup/soup.h> -#include <gweather-version.h> -#include "gweather-location.h" -#include "gweather-weather.h" +#include <libgweather/gweather-version.h> + +/* We use internal API */ #include "gweather-private.h" /* We use/test gweather_location_get_children */ diff --git a/libgweather/tools/meson.build b/libgweather/tools/meson.build new file mode 100644 index 0000000..c1f63c6 --- /dev/null +++ b/libgweather/tools/meson.build @@ -0,0 +1,40 @@ +tools = [ + { + 'name': 'locations', + }, + { + 'name': 'locations_utc', + }, + { + 'name': 'metar', + }, + { + 'name': 'sun_moon', + 'sources': [ + 'test_sun_moon.c', + '../weather-sun.c', + '../weather-moon.c', + ], + }, + { + 'name': 'weather', + } +] + +tools_cargs = [ + '-DTEST_LOCATIONS="@0@"'.format(locations_bin.full_path()), + '-DSCHEMASDIR="@0@/schemas"'.format(meson.source_root()), + '-DSCHEMAS_BUILDDIR="@0@/schemas"'.format(meson.build_root()), +] + +foreach tool: tools + tool_name = tool.get('name') + tool_sources = tool.get('sources', ['test_' + tool_name + '.c']) + + executable('test_' + tool_name, + sources: tool_sources, + c_args: tools_cargs, + dependencies: libgweather_static_dep, + install: false, + ) +endforeach diff --git a/libgweather/test_locations.c b/libgweather/tools/test_locations.c index 37b333e..c930101 100644 --- a/libgweather/test_locations.c +++ b/libgweather/tools/test_locations.c @@ -1,7 +1,11 @@ +/* test_locations.c: Test GWeatherLocationEntry + * + * SPDX-FileCopyrightText: The GWeather authors + * SPDX-License-Identifier: GPL-2.0-or-later + */ -#include <gweather-version.h> -#include "gweather-location-entry.h" -#include "gweather-timezone-menu.h" +#include <gtk/gtk.h> +#include <libgweather/gweather.h> static void deleted (GtkWidget *widget, GdkEvent *event, gpointer data) diff --git a/libgweather/test_locations_utc.c b/libgweather/tools/test_locations_utc.c index 2804448..105f1ed 100644 --- a/libgweather/test_locations_utc.c +++ b/libgweather/tools/test_locations_utc.c @@ -1,7 +1,11 @@ - -#include <gweather-version.h> -#include "gweather-location-entry.h" -#include "gweather-timezone-menu.h" +/* test_locations_utc.c: Test GWeatherLocationEntry with UTC time zone + * + * SPDX-FileCopyrightText: The GWeather authors + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include <gtk/gtk.h> +#include <libgweather/gweather.h> static void deleted (GtkWidget *widget, GdkEvent *event, gpointer data) diff --git a/libgweather/test_metar.c b/libgweather/tools/test_metar.c index 72a3e13..72a3e13 100644 --- a/libgweather/test_metar.c +++ b/libgweather/tools/test_metar.c diff --git a/libgweather/test_sun_moon.c b/libgweather/tools/test_sun_moon.c index 6cdfb50..6cdfb50 100644 --- a/libgweather/test_sun_moon.c +++ b/libgweather/tools/test_sun_moon.c diff --git a/libgweather/test_weather.c b/libgweather/tools/test_weather.c index 7773462..7773462 100644 --- a/libgweather/test_weather.c +++ b/libgweather/tools/test_weather.c |