tests/testthat/test-generateFrequencies.R

context("generateFrequencies")

test_that("generateFrequencies: use",{
  skip_on_cran()
  abund <- matrix(data = c(1, 0, 0, 1, 2, 0, 1, 1, 1), nrow = 3, byrow = TRUE)
	expected <- c(3,2,1)
	expect_equal(
		generateFrequencies(abund),
		expected
	)
})

test_that("generateFrequencies: abuse", {
  skip_on_cran()
  abund <- matrix(data = c(-1, 0, 0, 1, 2, 0, 1, 1, 1), nrow = 3, byrow = TRUE)
  expect_error(
    generateFrequencies(abund),
    "One or more entries in the abundance matrix is negative"
  )

  abund <- matrix(data = c(NA, 0, 0, 1, 2, 0, 1, 1, 1), nrow = 3, byrow = TRUE)

  expect_error(
    generateFrequencies(abund),
    "One or more entries in the abundance matrix is NA"
  )
})

Try the STEPCAM package in your browser

Any scripts or data that you put into this service are public.

STEPCAM documentation built on May 1, 2019, 10:11 p.m.