tests/testthat/test-get_dist_parms.R

context("get_dist_parms")

test_that("returns dataframes", {
  test_vector <- rnorm(n = 100)
  expect_equal(
    object = class(get_dist_parms(
      data = test_vector, distribution_type = "normal"
    )),
    expected = "data.frame"
  )

  test_vector <- rlnorm(n = 100)
  expect_equal(
    object = class(get_dist_parms(
      data = test_vector, distribution_type = "lognormal"
    )),
    expected = "data.frame"
  )

  test_vector <- rbeta(n = 100, shape1 = .5, shape2 = .5)
  expect_equal(
    object = class(get_dist_parms(
      data = test_vector, distribution_type = "beta"
    )),
    expected = "data.frame"
  )
})

test_that("nonsuported distributions return Error", {
  test_vector <- rnorm(n = 100)
  expect_error(object = get_dist_parms(
    data = test_vector, distribution_type = "OptimusPrime"
  ))
})

Try the traitstrap package in your browser

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

traitstrap documentation built on May 31, 2023, 7:59 p.m.