tests/testthat/test-qq_plot.R

# library(testthat)

context("Function `qq_plot()`")

test_that("`qq_plot()` works", {
  data("iris", package = "datasets")

  gg1 <- qq_plot(Sepal.Length ~ Species, data = iris)
  gg2 <- qq_plot("Sepal.Length", groups = "Species", data = iris)
  gg3 <- qq_plot("Sepal.Length", groups = "Species", data = iris, use_colors = TRUE)
  gg4 <- qq_plot(Sepal.Length ~ Species, data = iris, method = "trimmed-normal")
  gg5 <- qq_plot(Sepal.Length ~ Species, data = iris, method = "moment-normal")
  gg6 <- qq_plot(Sepal.Length ~ Species, data = iris, distribution = "t", df = 62)
  gg7 <- qq_plot(Sepal.Length ~ Species, data = iris, line = "robust")
  gg8 <- qq_plot(Sepal.Length ~ Species, data = iris, line = "0,1")
  gg9 <- qq_plot(Sepal.Length ~ Species, data = iris, line = "none")

  # expect_silent(plot(gg1))
  # expect_silent(print(gg1))
  expect_silent(gg1)
  expect_silent(gg2)
  expect_silent(gg3)
  expect_silent(gg4)
  expect_silent(gg5)
  expect_silent(gg6)
  expect_silent(gg7)
  expect_silent(gg8)
  expect_silent(gg9)

  expect_is(gg1, c("gg", "ggplot"))
  expect_is(gg2, c("gg", "ggplot"))
  expect_is(gg3, c("gg", "ggplot"))
  expect_is(gg4, c("gg", "ggplot"))
  expect_is(gg5, c("gg", "ggplot"))
  expect_is(gg6, c("gg", "ggplot"))
  expect_is(gg7, c("gg", "ggplot"))
  expect_is(gg8, c("gg", "ggplot"))
  expect_is(gg9, c("gg", "ggplot"))
})
GegznaV/BioStat documentation built on Aug. 14, 2020, 9:30 p.m.