tests/testthat/test-doctest-whv_rect.R

# Generated by doctest: do not edit by hand
# Please edit file in R/whv.R

test_that("Doctest: whv_rect", {
  # Created from @doctest for `whv_rect`
  # Source file: R/whv.R
  rectangles <- as.matrix(read.table(header = FALSE, text = "\n 1.0  3.0  2.0  Inf    1\n 2.0  3.5  2.5  Inf    2\n 2.0  3.0  3.0  3.5    3\n"))
  expect_equal(whv_rect(matrix(2, ncol = 2), rectangles, reference = 6), 4)
  expect_equal(whv_rect(matrix(c(2, 1), ncol = 2), rectangles, reference = 6), 4)
  expect_equal(whv_rect(matrix(c(1, 2), ncol = 2), rectangles, reference = 6), 7)
  expect_equal(total_whv_rect(matrix(2, ncol = 2), rectangles, reference = 6,
  ideal = c(1, 1)), 26)
  expect_equal(total_whv_rect(matrix(c(2, 1), ncol = 2), rectangles, reference = 6,
  ideal = c(1, 1)), 30)
  expect_equal(total_whv_rect(matrix(c(1, 2), ncol = 2), rectangles, reference = 6,
  ideal = c(1, 1)), 37.5)
})

Try the moocore package in your browser

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

moocore documentation built on July 12, 2026, 5:06 p.m.