Skip to content

Commit

Permalink
fix tests for #26
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Feb 20, 2024
1 parent b499f83 commit 743483a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: m4ra
Title: Many-to-Many Multi-Modal Routing Aggregator
Version: 0.1.1.032
Version: 0.1.1.033
Authors@R:
person(given = "Mark",
family = "Padgham",
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"codeRepository": "https://github.com/UrbanAnalyst/m4ra",
"issueTracker": "https://github.com/UrbanAnalyst/m4ra/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.1.1.032",
"version": "0.1.1.033",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
8 changes: 6 additions & 2 deletions tests/testthat/test-gtfs.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ fake_network_data <- function (gtfs, npts = 1e3) {
test_that ("gtfs travel times", {

z <- gtfsrouter::berlin_gtfs_to_zip ()
gtfs <- gtfsrouter::extract_gtfs (z)
suppressWarnings (
gtfs <- gtfsrouter::extract_gtfs (z)
)
gtfs <- gtfsrouter::gtfs_timetable (gtfs, day = "Monday")

Sys.setenv ("M4RA_NUM_CORES" = 1L)
Expand All @@ -84,7 +86,9 @@ test_that ("gtfs travel times", {
test_that ("gtfs to graph fns", {

z <- gtfsrouter::berlin_gtfs_to_zip ()
gtfs <- gtfsrouter::extract_gtfs (z)
suppressWarnings (
gtfs <- gtfsrouter::extract_gtfs (z)
)
gtfs <- gtfsrouter::gtfs_timetable (gtfs, day = "Monday")

npts <- 1e3L
Expand Down
8 changes: 5 additions & 3 deletions tests/testthat/test-prepare-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ test_that ("prepare data", {
Sys.setenv ("M4RA_NUM_CORES" = 1L)

z <- gtfsrouter::berlin_gtfs_to_zip ()
gtfs <- gtfsrouter::extract_gtfs (z)
suppressWarnings (
gtfs <- gtfsrouter::extract_gtfs (z)
)
gtfs_path <- fs::path (fs::path_temp (), "berlin-gtfs.Rds")
saveRDS (gtfs, gtfs_path)

Expand Down Expand Up @@ -41,9 +43,9 @@ test_that ("prepare data", {
expect_type (flist, "character")
expect_true (all (fs::file_exists (flist)))

expect_length (flist, 29L)
expect_length (flist, 23L)
# 3 weighted networks:
expect_length (grep ("foot|bicycle|motorcar", flist), 25L)
expect_length (grep ("foot|bicycle|motorcar", flist), 19L)
# 1 GTFS source:
expect_length (grep ("berlin\\-gtfs\\.Rds$", flist), 1L)
# plus three GTFS travel time matrices, and one GTFS-to-final network time
Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/test-weight-networks.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") |
identical (Sys.getenv ("GITHUB_WORKFLOW"), "test-coverage"))

Expand Down Expand Up @@ -26,6 +25,6 @@ test_that ("weight networks", {
)

expect_type (f, "character")
expect_length (f, 24L)
expect_length (f, 18L)
expect_true (all (fs::file_exists (f)))
})

0 comments on commit 743483a

Please sign in to comment.