Description Usage Arguments Author(s) See Also Examples
Tests a Standard R 'variable' ('RTestTest_vector_variable')
1 2 | test_returnValue_variable(result, reference, xmlTestSpec,
add.desc = NULL)
|
result |
( |
reference |
( |
xmlTestSpec |
( |
add.desc |
( |
Matthias Pfeifer matthias.pfeifer@roche.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # Cleaning up
tryCatch(unloadNamespace("RTest"))
tryCatch(unloadNamespace("testthat"))
library(RTest)
data <- '<test_variable desc="Compare a value"
diff-type="absolute" compare-type="equal" tolerance="1E-3"/>'
xmlTestSpec <- XML::xmlRoot(XML::xmlParse(data,asText=TRUE))
test_returnValue_variable(5,5,xmlTestSpec)
test_returnValue_variable(5.0001,5,xmlTestSpec)
# Compare variable with a stricter tolerance
data <- '<test_variable desc="Compare a value"
diff-type="relative" compare-type="equal" tolerance="1E-6"/>'
xmlTestSpec <- XML::xmlRoot(XML::xmlParse(data,asText=TRUE))
tryCatch(unloadNamespace("RTest"))
tryCatch(unloadNamespace("testthat"))
library(RTest)
tryCatch(
test_returnValue_variable(5.0001,5,xmlTestSpec),error=function(e){
stopifnot(grepl("5.0001 not equal to 5.",e))
})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.