Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Oct 19, 2023
1 parent 561e860 commit bc85365
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
12 changes: 6 additions & 6 deletions test/loader/gtfs/services_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "nigiri/loader/gtfs/calendar_date.h"
#include "nigiri/loader/gtfs/files.h"
#include "nigiri/loader/gtfs/services.h"
#include "nigiri/common/interval.h"
#include "nigiri/types.h"

#include "./test_data.h"
Expand Down Expand Up @@ -34,10 +35,12 @@ using namespace date;
*/

TEST(gtfs, service_dates) {
auto const i = interval{date::sys_days{July / 1 / 2006},
date::sys_days{August / 1 / 2006}};
auto dates =
read_calendar_date(example_files().get_file(kCalendarDatesFile).data());
auto calendar = read_calendar(example_files().get_file(kCalenderFile).data());
auto traffic_days = merge_traffic_days(calendar, dates);
auto traffic_days = merge_traffic_days(i, calendar, dates);

auto we_bit_str = std::string{"1111000110000011000001100000110"};
auto wd_bit_str = std::string{"0000111001111100111110011111001"};
Expand All @@ -46,9 +49,6 @@ TEST(gtfs, service_dates) {
auto const we_traffic_days = bitfield{we_bit_str};
auto const wd_traffic_days = bitfield{wd_bit_str};

EXPECT_EQ(July / 1 / 2006, traffic_days.interval_.from_);
EXPECT_EQ(August / 1 / 2006, traffic_days.interval_.to_);

EXPECT_EQ(we_traffic_days, *traffic_days.traffic_days_["WE"]);
EXPECT_EQ(wd_traffic_days, *traffic_days.traffic_days_["WD"]);
EXPECT_EQ(we_traffic_days, *traffic_days["WE"]);
EXPECT_EQ(wd_traffic_days, *traffic_days["WD"]);
}
7 changes: 6 additions & 1 deletion test/loader/gtfs/stop_time_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@

#include "./test_data.h"

using namespace date;

namespace nigiri::loader::gtfs {

TEST(gtfs, read_stop_times_example_data) {
auto const files = example_files();

timetable tt;
tt.date_range_ = interval{date::sys_days{July / 1 / 2006},
date::sys_days{August / 1 / 2006}};
tz_map timezones;

auto agencies =
Expand All @@ -22,7 +26,8 @@ TEST(gtfs, read_stop_times_example_data) {
auto const dates =
read_calendar_date(files.get_file(kCalendarDatesFile).data());
auto const calendar = read_calendar(files.get_file(kCalenderFile).data());
auto const services = merge_traffic_days(calendar, dates);
auto const services =
merge_traffic_days(tt.internal_interval_days(), calendar, dates);
auto trip_data =
read_trips(tt, routes, services, files.get_file(kTripsFile).data());
auto const stops = read_stops(source_idx_t{0}, tt, timezones,
Expand Down
11 changes: 9 additions & 2 deletions test/loader/gtfs/trip_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "./test_data.h"

using namespace date;
using namespace nigiri::loader;

namespace nigiri::loader::gtfs {
Expand All @@ -17,6 +18,8 @@ TEST(gtfs, read_trips_example_data) {
auto const files = example_files();

timetable tt;
tt.date_range_ = interval{date::sys_days{July / 1 / 2006},
date::sys_days{August / 1 / 2006}};
tz_map timezones;

auto agencies =
Expand All @@ -26,7 +29,8 @@ TEST(gtfs, read_trips_example_data) {
auto const dates =
read_calendar_date(files.get_file(kCalendarDatesFile).data());
auto const calendar = read_calendar(files.get_file(kCalenderFile).data());
auto const services = merge_traffic_days(calendar, dates);
auto const services =
merge_traffic_days(tt.internal_interval_days(), calendar, dates);
auto const trip_data =
read_trips(tt, routes, services, files.get_file(kTripsFile).data());

Expand All @@ -43,6 +47,8 @@ TEST(gtfs, read_trips_berlin_data) {
auto const files = berlin_files();

timetable tt;
tt.date_range_ = interval{date::sys_days{July / 1 / 2006},
date::sys_days{August / 1 / 2006}};
tz_map timezones;

auto agencies =
Expand All @@ -52,7 +58,8 @@ TEST(gtfs, read_trips_berlin_data) {
auto const dates =
read_calendar_date(files.get_file(kCalendarDatesFile).data());
auto const calendar = read_calendar(files.get_file(kCalenderFile).data());
auto const services = merge_traffic_days(calendar, dates);
auto const services =
merge_traffic_days(tt.internal_interval_days(), calendar, dates);
auto const trip_data =
read_trips(tt, routes, services, files.get_file(kTripsFile).data());

Expand Down

0 comments on commit bc85365

Please sign in to comment.