diff options
Diffstat (limited to 'dbfp_check.c')
-rw-r--r-- | dbfp_check.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/dbfp_check.c b/dbfp_check.c index 067918f..2c048d8 100644 --- a/dbfp_check.c +++ b/dbfp_check.c @@ -26,50 +26,42 @@ END_TEST START_TEST(test_dbfp_access) { - struct dbfp dbfp; - struct dbfp_status status; int err; + struct dbfp dbfp; + struct dbfp_location *locations = NULL; + size_t n; err = dbfp_init(&dbfp, api_key); ck_assert_int_eq(err, 0); - status = dbfp_query_location_name(&dbfp, "", NULL, NULL); - ck_assert_int_eq(status.error, 0); - ck_assert_int_eq(status.run_error, 0); - ck_assert_int_eq(status.parse_error, 0); - ck_assert_int_eq(status.curl_error, 0); - ck_assert_int_eq(status.api_error, 0); + err = dbfp_query_location_name(&dbfp, "", &n, &locations); + ck_assert_int_eq(err, 0); + free(locations); dbfp_close(&dbfp); } END_TEST START_TEST(test_dbfp_location_simple) { - struct dbfp dbfp; - struct dbfp_status status; int err; + struct dbfp dbfp; + struct dbfp_location *locations = NULL; size_t n; - struct dbfp_location *locs = NULL; err = dbfp_init(&dbfp, api_key); ck_assert_int_eq(err, 0); - status = dbfp_query_location_name(&dbfp, "freiburg", &n, &locs); - ck_assert_int_eq(status.error, 0); - ck_assert_int_eq(status.run_error, 0); - ck_assert_int_eq(status.parse_error, 0); - ck_assert_int_eq(status.curl_error, 0); - ck_assert_int_eq(status.api_error, 0); + err = dbfp_query_location_name(&dbfp, "freiburg", &n, &locations); + ck_assert_int_eq(err, 0); ck_assert_int_gt(n, 0); - ck_assert_ptr_ne(locs, NULL); - - ck_assert_str_eq(locs[0].name, "Freiburg(Breisgau) Hbf"); - ck_assert_str_eq(locs[0].id, "008000107"); + ck_assert_ptr_ne(locations, NULL); - free(locs); + ck_assert_str_eq(locations[0].name, "Freiburg(Breisgau) Hbf"); + ck_assert_str_eq(locations[0].id, "008000107"); + free(locations); dbfp_close(&dbfp); } END_TEST |