Commit 4e33703e authored by Dorchies David's avatar Dorchies David
Browse files

test(regression): add feature ignore specific items in compared variables

parent c00db7b3
......@@ -4,10 +4,14 @@
# ignored variable : [Topic]<SPACE>[Variable] or *<SPACE>[Variable] for every variable whatever the topic
# Example for ignoring OutputsModel variable produced by example("RunModel_GR2M"): RunModel_GR2M OutputsModel
* RunOptions
* RunOptions$Outputs_Sim
* RunOptions$FeatFUN_MOD
* RunOptions$FortranOutputs
RunModel_CemaNeige RunOptions$Outputs_Cal
Param_Sets_GR4J RunOptions_Cal
Param_Sets_GR4J RunOptions_Val
* OutputsModel
* OutputsModel$Param
* OutputsModel$WarmUpQsim
Param_Sets_GR4J OutputsModel_Val
RunModel_Lag OutputsModelDown
SeriesAggreg SimulatedMonthlyRegime
......@@ -13,6 +13,17 @@ CompareWithStable <- function(refVarFile, testDir, regIgnore) {
if (file.exists(testVarFile)) {
testVar <- readRDS(testVarFile)
refVar <- readRDS(refVarFile)
if (!is.null(regIgnore)) {
regIgnore$mainVar <- gsub("\\$.*$", "", regIgnore[,2])
varIgnore <- regIgnore[apply(regIgnore, 1, function(x) {v$var == x[3] && (x[1] == "*" || x[1] == v$topic)}), 2]
if (length(varIgnore) > 0) {
itemIgnore <- gsub("^.*\\$", "", varIgnore)
for(item in itemIgnore) {
testVar[[item]] <- NULL
refVar[[item]] <- NULL
}
}
}
expect_equivalent(testVar, refVar)
}
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment