File: test-vorob.R

package info (click to toggle)
r-cran-eaf 2.5.2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,016 kB
  • sloc: ansic: 7,281; perl: 848; makefile: 73; sh: 43; python: 27
file content (14 lines) | stat: -rw-r--r-- 653 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
test_that("vorob", {
  #skip_on_cran()
  test_data <- expand.grid(seq(0, 1, length.out = 51),
                           seq(0, 1, length.out = 51))
  test_data <- as.matrix(cbind(test_data, nrun = 1:nrow(test_data)))
  
  # Average hypervolume is known to be 0.25
  # avg_hyp <- mean(sapply(split.data.frame(test_data[,1:2], test_data[,3]),
  #                        hypervolume, reference = c(1, 1))) 
  expect_equal(hypervolume(vorobT(x = test_data, reference = c(1, 1))$VE, reference = c(1, 1)), 0.25, tolerance = 1e-1)
  
  expect_equal(vorobDev(x = test_data, VE = vorobT(test_data, c(1,1))$VE, reference = c(1, 1)), 0.218, tolerance = 1e-1)

})