tests/testthat/test-partition_location.R

test_that("location in partition", {
  t <- c(0.1, 1.1, 2.1, 3, 4, 5)
  p1 <- c(0, 1, 2, 3, 4, 5)
  p2 <- c(0, 1, 2, 3, 4, 5, 6)
  p3 <- c(0, 0.5, 1, 1.5, 2)

  expect_identical(
    partition_location(t, p1),
    c(1, 2, 3, 3, 4, 5)
    )
  expect_identical(
    partition_location(t, p2),
    c(1, 2, 3, 3, 4, 5)
  )
  expect_identical(
    partition_location(t, p3),
    c(1, 3, 5, 5, 5, 5)
  )
})
josbop/BayesBiSurv documentation built on June 15, 2020, 3:45 a.m.