-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix some tests with new study test 870
- Loading branch information
BERTHET Clement (Externe)
committed
Dec 11, 2023
1 parent
7755082
commit e35840a
Showing
3 changed files
with
62 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,53 @@ | ||
test_that("readBindingConstraint", { | ||
context("bindingConstraints") | ||
|
||
# >= v710 ---- | ||
opts <- setSimulationPath(studyPathS, 0) | ||
|
||
test_that("returns an object of class 'bindingConstraints'", { | ||
constraints <- readBindingConstraints(opts) | ||
expect_is(constraints, "bindingConstraints") | ||
}) | ||
|
||
test_that("summary.bindingConstraints",{ | ||
constraints <- readBindingConstraints(opts) | ||
sumConstraints <- summary(constraints) | ||
expect_is(sumConstraints, "data.frame") | ||
expect_true(all(c("enabled", "timeStep", "equation") %in% | ||
names(sumConstraints))) | ||
}) | ||
|
||
|
||
test_that("Both operator",{ | ||
constraints <- readBindingConstraints(opts) | ||
constraints[[1]]$operator <- "both" | ||
sumConstraints <- summary(constraints) | ||
expect_is(sumConstraints, "data.frame") | ||
expect_true(all(c("enabled", "timeStep", "equation") %in% | ||
names(sumConstraints))) | ||
}) | ||
|
||
##delete study ---- | ||
#unlink(studyPathS, recursive = TRUE) | ||
|
||
# >= v800 ---- | ||
# | ||
opts <- antaresRead::setSimulationPath(studyPathSV8[1], "input") | ||
|
||
test_that("test if exist data value file", { | ||
bc <- antaresRead::readBindingConstraints(opts = opts) | ||
|
||
# test class object return | ||
testthat::expect_equal(class(bc), "bindingConstraints") | ||
|
||
names_bc_test <- paste0(names(bc), ".txt") | ||
path_test_bc <- paste0(file.path(opts$inputPath, "bindingconstraints", names_bc_test)) | ||
|
||
# test for versions v710 v800 v850 | ||
all_path_studies <- c(studyPathS, studyPathSV8) | ||
sapply(all_path_studies, function(study) { | ||
opts <- antaresRead::setSimulationPath(study, "input") | ||
|
||
bc <- antaresRead::readBindingConstraints(opts = opts) | ||
# test class object return | ||
testthat::expect_equal(class(bc), "bindingConstraints") | ||
|
||
names_bc_test <- paste0(names(bc), ".txt") | ||
path_test_bc <- paste0(file.path(opts$inputPath, "bindingconstraints", names_bc_test)) | ||
# test if values files exists | ||
testthat::expect_true(all(unlist(lapply(path_test_bc, file.exists)))) | ||
}) | ||
# test if values files exists | ||
testthat::expect_true(all(unlist(lapply(path_test_bc, file.exists)))) | ||
}) | ||
|
||
|
||
# >= v870 ---- | ||
# | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters