tests/testthat/test_wrapped_soo_function.R

context("wrapped_soo_function")

check_wrapped <- function(orig, wrapped) {
  expect_equal(lower_bounds(wrapped), lower_bounds(orig))
  expect_equal(upper_bounds(wrapped), upper_bounds(orig))
  expect_equal(global_minimum(wrapped), global_minimum(orig))
  expect_equal(number_of_parameters(wrapped), number_of_parameters(orig))
}

test_that("nested {recording,counting}_function", {
  fn <- generate_sphere_function(10)
  fn1 <- counting_function(recording_function(fn))
  fn2 <- recording_function(counting_function(fn))
  check_wrapped(fn, fn1)
  check_wrapped(fn, fn2)
})

Try the soobench package in your browser

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

soobench documentation built on Feb. 9, 2020, 5:08 p.m.