From 79caacde22d30c2f77a07d52e5d0ed28632a6894 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sat, 14 Jan 2017 15:21:14 +0100 Subject: dbfp_check: remove specific departure check The requestable time range changes, therefore testing with specific times is not reproducible. --- dbfp_check.c | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/dbfp_check.c b/dbfp_check.c index a5ec7f7..1000a3d 100644 --- a/dbfp_check.c +++ b/dbfp_check.c @@ -16,11 +16,6 @@ static void assert_location_eq(size_t n, struct dbfp_location *locations, size_t i, const char *name, const char *id, float lon, float lat); -static void assert_departure_eq(size_t n, struct dbfp_departure *departures, - size_t i, const char *name, const char *type, - const char *stopid, const char *stop, time_t time, - const char *direction, const char *track); - START_TEST(test_dbfp_create) { struct dbfp dbfp; @@ -95,9 +90,7 @@ START_TEST(test_dbfp_departure_simple) int err; struct dbfp dbfp; struct dbfp_departure *departures = NULL; - struct tm tm = { .tm_year = 116, .tm_mon = 5, .tm_mday = 1, - .tm_hour = 17, .tm_min = 42 }; - time_t time = mktime(&tm); + time_t now = time(0); size_t n; size_t i; @@ -111,18 +104,9 @@ START_TEST(test_dbfp_departure_simple) dbfp_departure_close(&departures[i]); free(departures); - err = dbfp_query_departure(&dbfp, "8000105", time, &n, + err = dbfp_query_departure(&dbfp, "8000105", now, &n, &departures); ck_assert_int_eq(err, 0); - tm.tm_hour++; - time = mktime(&tm); - assert_departure_eq(n, departures, 0, "ICE 1556", "ICE", "8000105", - "Frankfurt(Main)Hbf", time, "Wiesbaden Hbf", "6"); - tm.tm_min = 49; - time = mktime(&tm); - assert_departure_eq(n, departures, 1, "IC 2274", "IC", "8000105", - "Frankfurt(Main)Hbf", time, "Kassel-Wilhelmshöhe", - "11"); for (i = 0; i < n; i++) dbfp_departure_close(&departures[i]); free(departures); @@ -181,20 +165,3 @@ static void assert_location_eq(size_t n, struct dbfp_location *locations, ck_assert(locations[i].lon == lon); ck_assert(locations[i].lat == lat); } - -static void assert_departure_eq(size_t n, struct dbfp_departure *departures, - size_t i, const char *name, const char *type, - const char *stopid, const char *stop, time_t time, - const char *direction, const char *track) -{ - ck_assert_ptr_ne(departures, NULL); - ck_assert_uint_lt(i, n); - - ck_assert_str_eq(departures[i].name, name); - ck_assert_str_eq(departures[i].type, type); - ck_assert_str_eq(departures[i].stopid, stopid); - ck_assert_str_eq(departures[i].stop, stop); - ck_assert_uint_eq(departures[i].time, time); - ck_assert_str_eq(departures[i].direction, direction); - ck_assert_str_eq(departures[i].track, track); -} -- cgit v1.2.1