test_that("sanitise_xml() escapes comparison operators for a single equation", {
test_text <- '
IF_THEN_ELSE(a > b :AND: a <= c , a, 0)
'
actual_output <- sanitise_xml(test_text)
expected_output <- '
IF_THEN_ELSE(a > b :AND: a <= c , a, 0)
'
expect_equal(actual_output, expected_output)
})
test_that("sanitise_xml() escapes comparison operators for multiple equation", {
test_text <- '
IF_THEN_ELSE(a > b :AND: a <= c , a, 0)
IF_THEN_ELSE(b > a :AND: c <= a , 0, a)
IF_THEN_ELSE(b < a :AND: c >= a , b, a)
'
actual_output <- sanitise_xml(test_text)
expected_output <- '
IF_THEN_ELSE(a > b :AND: a <= c , a, 0)
IF_THEN_ELSE(b > a :AND: c <= a , 0, a)
IF_THEN_ELSE(b < a :AND: c >= a , b, a)
'
expect_equal(actual_output, expected_output)
})
test_that("sanitise_xml() does not alter the original xml code", {
test_text <- '
a + b
a + c
b + c
'
actual_output <- sanitise_xml(test_text)
expected_output <- '
a + b
a + c
b + c
'
expect_equal(actual_output, expected_output)
})