Skip to content

Commit

Permalink
* tests/testthat/test-bug-blocksize.R: Delete. Move into...
Browse files Browse the repository at this point in the history
 * tests/testthat/test-bug-10.R: ... here.
  • Loading branch information
MLopez-Ibanez committed Dec 8, 2024
1 parent 29a4375 commit a8a520d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 43 deletions.
38 changes: 31 additions & 7 deletions tests/testthat/test-bug-10.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# https://github.com/MLopez-Ibanez/irace/issues/10
withr::with_output_sink("test-bug-10.Rout", {
test_that("bug 10", {
skip_on_cran()

parameters_txt <- '
algorithm "--" c (as,mmas,eas,ras,acs)
localsearch "--localsearch " c (0, 1, 2, 3)
Expand All @@ -15,13 +13,38 @@ elitistants "--elitistants " i (1, 750) | algorithm == "eas"
nnls "--nnls " i (5, 50) | localsearch %in% c(1,2,3)
dlb "--dlb " c (0, 1) | localsearch %in% c(1,2,3)
'
target.runner <- function(experiment, scenario)
list(cost = 100, call = toString(experiment))

parameters <- irace:::readParameters(text=parameters_txt)

test_that("bug blocksize", {
skip_on_cran()

target_runner <- function(experiment, scenario)
list(cost = 100 + rnorm(1, 0, 0.1), call = toString(experiment))

withr::with_options(list(warning=2), {
scenario <- list(targetRunner = target_runner,
instances=1:5, firstTest=5*5, eachTest=5,
sampleInstances=FALSE,
maxExperiments = 5000, logFile = "",
elitistNewInstances = 1,
elitist = TRUE,
parameters = parameters)
scenario <- checkScenario (scenario)
confs <- irace(scenario = scenario)
expect_false(is.null(confs))
})
})

# https://github.com/MLopez-Ibanez/irace/issues/10
test_that("bug 10", {
skip_on_cran()

target_runner <- function(experiment, scenario)
list(cost = 100, call = toString(experiment))

withr::with_options(list(warning=2), {
scenario <- list(targetRunner = target.runner,
scenario <- list(targetRunner = target_runner,
instances=1:10,
maxExperiments = 5000, logFile = "",
deterministic = TRUE,
Expand All @@ -34,4 +57,5 @@ withr::with_options(list(warning=2), {
expect_false(is.null(confs))
})
})
})

}) # withr::with_output_sink
36 changes: 0 additions & 36 deletions tests/testthat/test-bug-blocksize.R

This file was deleted.

0 comments on commit a8a520d

Please sign in to comment.