Skip to content

Commit

Permalink
Merge pull request #272 from UrbanAnalyst/tests
Browse files Browse the repository at this point in the history
rm test expectations for #271
  • Loading branch information
mpadge authored Feb 16, 2025
2 parents 85bdda1 + 352bfe1 commit 092bd61
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 41 deletions.
6 changes: 6 additions & 0 deletions .hooks/no-commit-to-main
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env Rscript

# do not commit to main branch
on_main <- identical (gert::git_branch (), "main")
if (on_main)
stop ("main branch is protected on GitHub; commits must be made via PR from other branch")
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ repos:
name: Version has been incremeneted in DESCRIPTION
entry: .hooks/description
language: script
- id: Commit via PR only
name: Commit made to non-main branch
entry: .hooks/no-commit-to-main
language: script

ci:
autoupdate_schedule: monthly
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dodgr
Title: Distances on Directed Graphs
Version: 0.4.1.052
Version: 0.4.1.054
Authors@R: c(
person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre")),
person("Andreas", "Petutschnig", role = "aut"),
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"codeRepository": "https://github.com/UrbanAnalyst/dodgr",
"issueTracker": "https://github.com/UrbanAnalyst/dodgr/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.4.1.052",
"version": "0.4.1.054",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
10 changes: 4 additions & 6 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# CRAN notes for dodgr_0.4.1 submission
# CRAN notes for dodgr_0.4.2 submission

This submission fixes previous warnings from g++ 14.x which arose on CRAN Fedora checks.
This submission fixes the test failures seen on current CRAN version.

It also rectifies one NOTE on namespace imports not used.

This submission generates the following NOTES on some systems:
Beyond that, this submission generates the following NOTES on some systems:

- Possibly invalid URLs, all of which are GitHub because of "Too Many Requests," and not because of the URLs themselves.
* "GNU make is a SystemRequirements", which is unavoidable because of the need to remove compiled object files in src sub-directories.
- Size Notes, which are also unavoidable as they are largely due to size of compiled "libs".

Other than these, this submission generates no additional notes, and no warnings on:

* Ubuntu 22.04: R-release, R-devel
* Ubuntu 24.04: R-release, R-devel
* win-builder (R-release, R-devel, R-oldrelease)
- clang UBSAN on R-devel
10 changes: 5 additions & 5 deletions tests/testthat/test-dists-categorical.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (!test_all) {

test_that ("categorical dists", {

expect_silent (graph <- weight_streetnet (hampi))
graph <- weight_streetnet (hampi)

nf <- 100
nt <- 50
Expand Down Expand Up @@ -94,7 +94,7 @@ test_that ("categorical dists results", {

test_that ("categorical dists summary", {

expect_silent (graph <- weight_streetnet (hampi))
graph <- weight_streetnet (hampi)
graph <- graph [graph$component == 1, ]

v <- dodgr_vertices (graph)
Expand All @@ -113,7 +113,7 @@ test_that ("categorical dists summary", {

test_that ("proportions only", {

expect_silent (graph <- weight_streetnet (hampi))
graph <- weight_streetnet (hampi)
graph <- graph [graph$component == 1, ]

v <- dodgr_vertices (graph)
Expand Down Expand Up @@ -141,7 +141,7 @@ test_that ("proportions only", {

test_that ("categorical threshold", {

expect_silent (graph <- weight_streetnet (hampi))
graph <- weight_streetnet (hampi)
graph <- graph [graph$component == 1, ]

v <- dodgr_vertices (graph)
Expand All @@ -163,7 +163,7 @@ test_that ("categorical threshold", {

test_that ("categorical pairwise", {

expect_silent (graph <- weight_streetnet (hampi))
graph <- weight_streetnet (hampi)
graph <- graph [graph$component == 1, ]

v <- dodgr_vertices (graph)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-dists-nearest.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if (!test_all) {

test_that ("categorical nearest dists", {

expect_silent (graph <- weight_streetnet (hampi))
graph <- weight_streetnet (hampi)

nf <- 50
nt <- 100
Expand Down
34 changes: 9 additions & 25 deletions tests/testthat/test-dists.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if (!test_all) {
}

test_that ("dists", {
expect_silent (graph <- weight_streetnet (hampi))
graph <- weight_streetnet (hampi)
nf <- 100
nt <- 50
set.seed (1)
Expand Down Expand Up @@ -74,7 +74,7 @@ test_that ("dists", {
})

test_that ("dists-pairwise", {
expect_silent (graph <- weight_streetnet (hampi))
graph <- weight_streetnet (hampi)
n <- 50
set.seed (1)
from <- sample (graph$from_id, size = n)
Expand Down Expand Up @@ -314,34 +314,18 @@ test_that ("heaps", {
dodgr_dists (graph, from = from, to = to, heap = "wrong heap"),
"'arg' should be one of"
)
expect_silent (d0 <- dodgr_dists (graph,
from = from,
to = to,
heap = "BHeap"
))
expect_silent (d1 <- dodgr_dists (graph,
from = from,
to = to,
heap = "FHeap"
))
expect_silent (d3 <- dodgr_dists (graph,
from = from,
to = to,
heap = "TriHeap"
))
expect_silent (d4 <- dodgr_dists (graph,
from = from,
to = to,
heap = "TriHeapExt"
))
d0 <- dodgr_dists (graph, from = from, to = to, heap = "BHeap")
d1 <- dodgr_dists (graph, from = from, to = to, heap = "FHeap")
d3 <- dodgr_dists (graph, from = from, to = to, heap = "TriHeap")
d4 <- dodgr_dists (graph, from = from, to = to, heap = "TriHeapExt")
# This is a compound message that starts "Calculating shortest paths ..."
# and then "Extended TriHeaps can not be calculated in parallel
# That can't be tested, so just generic expect_message here
expect_message (d4a <- dodgr_dists (graph,
from = from, to = to,
heap = "TriHeapExt", quiet = FALSE
))
expect_silent (d5 <- dodgr_dists (graph, from = from, to = to, heap = "Heap23"))
d5 <- dodgr_dists (graph, from = from, to = to, heap = "Heap23")

d4 <- dodgr_dists (graph,
from = from,
Expand All @@ -365,7 +349,7 @@ test_that ("heaps", {
})

test_that ("graph columns", {
expect_silent (graph <- weight_streetnet (hampi))
graph <- weight_streetnet (hampi)
nf <- 100
nt <- 50
set.seed (1)
Expand Down Expand Up @@ -395,7 +379,7 @@ test_that ("graph columns", {
})

test_that ("negative weights", {
expect_silent (graph <- weight_streetnet (hampi))
graph <- weight_streetnet (hampi)
nf <- 100
nt <- 50
set.seed (1)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-iso.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ test_that ("isodists", {
# This all exists just to test the next line:
requireNamespace ("geodist")
requireNamespace ("dplyr")
expect_no_message (net <- weight_streetnet (hsc,
net <- weight_streetnet (hsc,
wt_profile = "bicycle"
))
)
npts <- 100
set.seed (1)
from <- sample (net$.vx0, size = npts)
Expand Down

0 comments on commit 092bd61

Please sign in to comment.