revdep/checks.noindex/SDMtune/old/SDMtune.Rcheck/tests/testthat/test-plotCor.R

p <- plotCor(SDMtune:::t, cor_th = .8)

test_that("The plot has the correct labels", {
  expect_equal(p$plot_env$label, "Spearman's\ncoefficient")
  expect_equal(p$labels$x, "Var2")
  expect_equal(p$labels$y, "Var1")
})

test_that("The plot as the correct text when using cor_th argument", {
  expect_true(sum(abs(p$layers[[2]]$data$value) >= .8) == nrow(p$layers[[2]]$data))
})

test_that("The plot has the correct text when the argument cor_th is NULL", {
  p <- plotCor(SDMtune:::t)
  expect_identical(length(p$layers[[2]]$data$value), nrow(p$data))
})
gbm-developers/gbm documentation built on Feb. 16, 2024, 6:13 p.m.