Skip to content

Commit

Permalink
🎈tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Sep 8, 2019
1 parent 55d18f0 commit 3979ea0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
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.2.0.008
Version: 0.2.0.009
Authors@R: c(
person("Mark", "Padgham", email="[email protected]", role=c("aut", "cre")),
person("Andreas", "Petutschnig", role="aut"),
Expand Down
6 changes: 3 additions & 3 deletions src/fund-cycles.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class AdjacencyMatrix
inline void AdjacencyMatrix::connect (size_t i, size_t j)
{
if (AdjacencyMatrix::m_Adjacencies [AdjacencyMatrix::get_adj_index (i, j)])
return;
return; // nocov

AdjacencyMatrix::m_Adjacencies [AdjacencyMatrix::get_adj_index (i, j)] = true;
AdjacencyMatrix::m_nEdges++;
Expand All @@ -117,7 +117,7 @@ inline void AdjacencyMatrix::connect (size_t i, size_t j)
inline void AdjacencyMatrix::disconnect (size_t i, size_t j)
{
if (!AdjacencyMatrix::m_Adjacencies [AdjacencyMatrix::get_adj_index (i, j)])
return;
return; // nocov

AdjacencyMatrix::m_Adjacencies [AdjacencyMatrix::get_adj_index (i, j)] = false;
AdjacencyMatrix::m_nEdges--;
Expand Down Expand Up @@ -189,7 +189,7 @@ template <class TObject>
void Graph<TObject>::computeFundamentalCycles()
{
if (!Graph<TObject>::m_fundamentalCycles.empty())
return;
return; // nocov

std::unique_ptr <TreeNode []>
aTree (new TreeNode [Graph::m_nodeArray.size ()]);
Expand Down
13 changes: 13 additions & 0 deletions tests/testthat/test-iso.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ test_that("isodists", {
expect_true (length (unique (d$dlim)) == length (dlim))
})

test_that ("errors", {
expect_silent (hsc <- sf_to_sc (hampi))
expect_silent (net <- weight_streetnet (hsc,
wt_profile = "bicycle"))
npts <- 100
from <- sample (net$.vx0, size = npts)
dlim <- c (1, 2, 5, 10, 20) * 100
expect_error (d <- dodgr_isodists (net, from = from),
"dlim must be specified")
expect_error (d <- dodgr_isodists (net, from = from, dlim = "a"),
"dlim must be numeric")
})

test_that("isochrones", {
expect_silent (hsc <- sf_to_sc (hampi))
# This all exists just to test the next line:
Expand Down

0 comments on commit 3979ea0

Please sign in to comment.