diff --git a/tests/testthat/test_plot.R b/tests/testthat/test_plot.R index d8a28fe..b8f66ed 100644 --- a/tests/testthat/test_plot.R +++ b/tests/testthat/test_plot.R @@ -56,6 +56,14 @@ test_that("Testing plot.foehnix function", { expect_silent(plotfun(mod0, which = 1:2, ask = FALSE)) expect_silent(plotfun(mod1, which = 1:2, ask = FALSE)) + # Posterior plot with custom freq/breaks + expect_silent(plotfun(mod1, which = "post")) + expect_silent(plotfun(mod1, which = "post", freq = TRUE)) + expect_silent(plotfun(mod1, which = "post", freq = FALSE)) + expect_error(plotfun(mod1, which = "post", freq = "wrong")) + expect_silent(plot(mod1, which = "post", breaks = seq(0, 1, by = 0.05))) + expect_silent(plot(mod1, which = "post", breaks = c(0, 0.2, 0.4, 0.9, 1.0))) + # Setting log to FALSE expect_silent(plotfun(mod0, log = FALSE, ask = FALSE)) expect_silent(plotfun(mod1, log = FALSE, ask = FALSE)) diff --git a/tests/testthat/test_windrose.R b/tests/testthat/test_windrose.R index 1fb4cb3..369660f 100644 --- a/tests/testthat/test_windrose.R +++ b/tests/testthat/test_windrose.R @@ -31,6 +31,7 @@ test_that("Testing wind rose plot functionality (basic type)", { # Wind speed < 0 expect_error(windrosefun(dd = c(10,180), ff = c(-3,1))) + # Loading some data expect_silent(data <- demodata("ellboegen")) @@ -44,6 +45,9 @@ test_that("Testing wind rose plot functionality (basic type)", { expect_identical(dim(res$tab), c(length(res$dd.breaks), length(res$ff.breaks)) - 1L) expect_true(is.null(res$counts)) + # Custom breaks + expect_silent(windrosefun(data, breaks = seq(0, 30, by = 2.5))) + expect_warning(windrosefun(data, breaks = seq(0, 10, by = 2.5))) # Second: the histogram plot expect_silent(res <- windrosefun(as.numeric(data$dd), as.numeric(data$ff), @@ -63,7 +67,7 @@ test_that("Testing wind rose plot functionality (basic type)", { copy <- data names(copy)[grep("^ff$", names(copy))] <- "wind_spd" names(copy)[grep("^dd$", names(copy))] <- "wind_dir" - expect_silent(windrosefun(copy, var.ff = "wind_spd", var.dd = "wind_dir")) + expect_silent(windrosefun(copy, ffvar = "wind_spd", ddvar = "wind_dir")) })