Skip to content

Commit

Permalink
Adjust tests to avoid intermittent failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
MLopez-Ibanez committed Mar 3, 2024
1 parent b117347 commit 23d36b0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/dummy/target-runner-dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ int main(int argc, char *argv[])
}
double cost = instance + (p_int * p_real) + rand01();
double time = (time_is_cost) ? cost : (
(bound > 0) ? (bound+1) * rand01() + 0.00001 : instance + (int) (100 * rand01())
(bound > 0) ? (bound+1) * rand01() + 0.00001 : instance + (int) (10 * rand01())
);

if (bound > 0 && time > bound) {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-blocksize.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ time.irace <- function(...)
{
args <- list(...)
parameters <- readParameters(text = '
tmax "" i (1, 50)
tmax "" i (-10, 10)
temp "" r (0, 10)
')
scenario <- list(targetRunner = target.runner.time,
Expand Down
17 changes: 8 additions & 9 deletions tests/testthat/test-target-runner-dummy.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,21 @@ withr::with_output_sink("test-target-runner-dummy.Rout", {
})
test_that("--max-time", {
expect_warning(
expect_warning(
run_cmdline(paste0('p_int "--p_int " i (1, 5)\n',
'p_real "--p_real " r (1, 5)\n',
'time "--time " c (1)\n'),
'--max-time 2500'),
"With the current settings and estimated time per run"),
"No scenario file given")
run_cmdline(paste0('p_int "--p_int " c (1)\n',
'p_real "--p_real " r (0, 1)\n',
'dummy1 "--dummy1 " r (0, 1)\n',
'time "--time " c (1)\n'),
'--max-time 2500'),
"No scenario file given")
})
test_that("boundMax is too large", {
expect_warning(
expect_warning(
run_cmdline(paste0('p_int "--p_int " i (1, 10)\n',
'p_real "--p_real " r (1, 10)\n',
'p_real "--p_real " r (0, 1)\n',
'time "--time " c (1)\n',
'capping "--opt-time " c (1)\n'),
'--max-time 100 --bound-max 1 --capping 1'),
'--max-time 1000 --bound-max 100 --capping 1'),
"is too large"),
"No scenario file given")
})
Expand Down

0 comments on commit 23d36b0

Please sign in to comment.