Skip to content

Commit

Permalink
force numeric threshold group_lines
Browse files Browse the repository at this point in the history
  • Loading branch information
robitalec committed Sep 17, 2018
1 parent ad3a1a3 commit 69061b3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions R/group_lines.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ group_lines <-
if (is.null(threshold)) {
message('threshold missing, using 0 by default')
threshold <- 0
} else if (!is.numeric(threshold)) {
stop('threshold must be numeric')
} else if (threshold < 0) {
stop('cannot provide a negative threshold')
}
Expand Down
13 changes: 13 additions & 0 deletions tests/testthat/test-group-lines.R
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,19 @@ test_that('threshold is correctly provided, or error', {
sortBy = 'datetime'
)
)

expect_error(
group_lines(
DT = DT,
threshold = '0',
timegroup = 'timegroup',
id = 'ID',
coords = c('X', 'Y'),
projection = utm,
sortBy = 'datetime'
),
'threshold must be numeric'
)
})


Expand Down

0 comments on commit 69061b3

Please sign in to comment.