| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
> |
| 7 |
|
| 8 |
|
| 9 |
#include "cbd-test.h" |
| 10 |
|
| 11 |
#include "cbd-service-providers.h" |
| 12 |
|
| 13 |
#include <gio/gio.h> |
| 14 |
#include <glib.h> |
| 15 |
|
| 16 |
|
| 17 |
static void |
| 18 |
test_service_providers_parse_de (void) |
| 19 |
{ |
| 20 |
g_autoptr (GError) err = NULL; |
| 21 |
g_autoptr (GArray) channels = NULL; |
| 22 |
g_autoptr (GArray) expected = NULL; |
| 23 |
|
| 24 |
channels = cbd_service_providers_get_channels_sync (TEST_DATABASE, "dE", &err); |
| 25 |
|
| 26 |
g_assert_no_error (err); |
| 27 |
g_assert_nonnull (channels); |
| 28 |
|
| 29 |
expected = cbd_test_channels_get_expected ("de"); |
| 30 |
cbd_assert_cmp_channels (channels, expected); |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
static void |
| 35 |
test_service_providers_parse_us (void) |
| 36 |
{ |
| 37 |
g_autoptr (GError) err = NULL; |
| 38 |
g_autoptr (GArray) channels = NULL; |
| 39 |
g_autoptr (GArray) expected = NULL; |
| 40 |
|
| 41 |
channels = cbd_service_providers_get_channels_sync (TEST_DATABASE, "us", &err); |
| 42 |
|
| 43 |
g_assert_no_error (err); |
| 44 |
g_assert_nonnull (channels); |
| 45 |
expected = cbd_test_channels_get_expected ("us"); |
| 46 |
cbd_assert_cmp_channels (channels, expected); |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
static void |
| 51 |
test_service_providers_parse_doesnotexist (void) |
| 52 |
{ |
| 53 |
g_autoptr (GError) err = NULL; |
| 54 |
g_autoptr (GArray) channels = NULL; |
| 55 |
|
| 56 |
channels = cbd_service_providers_get_channels_sync (TEST_DATABASE, "doesnotexist", &err); |
| 57 |
|
| 58 |
g_assert_error (err, G_IO_ERROR, G_IO_ERROR_FAILED); |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
gint |
| 63 |
main (gint argc, gchar *argv[]) |
| 64 |
{ |
| 65 |
g_test_init (&argc, &argv, NULL); |
| 66 |
|
| 67 |
g_test_add_func ("/cbd/service-providers/parse/de", test_service_providers_parse_de); |
| 68 |
g_test_add_func ("/cbd/service-providers/parse/us", test_service_providers_parse_us); |
| 69 |
g_test_add_func ("/cbd/service-providers/parse/doesnotexist", |
| 70 |
test_service_providers_parse_doesnotexist); |
| 71 |
|
| 72 |
return g_test_run (); |
| 73 |
} |