test_returnValue_vector_elementbyelement: Tests a Standard R 'vector' Element-By-Element...

Description Usage Arguments Author(s) See Also Examples

View source: R/utils.test.R

Description

Tests a Standard R 'vector' Element-By-Element ('RTestTest_vector_elementbyelement')

Usage

1
2
test_returnValue_vector_elementbyelement(result, reference, xmlTestSpec,
  add.desc = NULL)

Arguments

result

(vector) The result vector to be tested

reference

(vector) The reference vector

xmlTestSpec

(XMLNode) The XML definition of type 'RTestTest_vector_elementbyelement'

add.desc

(character) Additional description added to the XML definition.

Author(s)

Matthias Pfeifer matthias.pfeifer@roche.com

See Also

XMLNode-class

Examples

 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
# 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_vector_elementbyelement(c(5,5),c(5,5),xmlTestSpec)
test_returnValue_vector_elementbyelement(c(5,5),c(5,5.000001),xmlTestSpec)

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_vector_elementbyelement(c(5,5),c(5,5.0001),xmlTestSpec),
    error=function(e){
      stopifnot(grepl("5 not equal to 5.0001.",e))
     })

RTest documentation built on Dec. 4, 2019, 5:07 p.m.