tests/testthat/test-shape_sim.R

test_that("first example works", {

  abc <- shape_sim(periods_number=20, shape_number=5)

  expect_s3_class(abc, "data.frame")
  expect_equal(dim(abc), c(105,3))
  expect_type(abc$shape, "double")
  expect_type(abc$assigned_shape, "integer")
})



test_that("second example works", {

  abc <- shape_sim(periods_number=20,
                   shape_number=5,
                   shape_type="trapezoid")

  expect_s3_class(abc, "data.frame")
  expect_equal(dim(abc), c(105,3))
  expect_type(abc$shape, "double")
  expect_type(abc$assigned_shape, "integer")
})


test_that("detection of shape type works", {

  expect_error(shape_sim(periods_number=20,
                         shape_number=5,
                         shape_type="intro"))

})

Try the npdsim package in your browser

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

npdsim documentation built on April 12, 2025, 1:37 a.m.