Skip to content

Commit

Permalink
Closes #9 -- fix inoperative check on type of 'unit' argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Chirico authored and joshuaulrich committed Oct 24, 2018
1 parent 5dd4a25 commit b779328
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/microbenchmark.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ microbenchmark <- function(..., list=NULL,
setup=NULL) {
stopifnot(times == as.integer(times))
if (!missing(unit))
stopifnot(is.character("unit"), length(unit) == 1L)
stopifnot(is.character(unit), length(unit) == 1L)

control[["warmup"]] <- coalesce(control[["warmup"]], 2^18L)
control[["order"]] <- coalesce(control[["order"]], "random")
Expand Down
7 changes: 7 additions & 0 deletions inst/tests/test_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ test_unit_f <- function()
}
test_unit_f()

test_unit_int <- function()
{
out <- try(print(microbenchmark(NULL, unit=4)), silent = TRUE)
stopifnot(!inherits(out, "try-error"))
}
test_unit_int()

test_simple_timing <- function()
{
set.seed(21)
Expand Down

0 comments on commit b779328

Please sign in to comment.