swig/Examples/test-suite/r/unittest.R
Richard Beare 5c2cd32795 Corrected the testing in unittest so that all elements of
a vector result are checked. Previously it was just the first
element.
2016-03-15 12:14:20 +11:00

17 lines
265 B
R

unittest <- function (x,y) {
if (all(x==y)) {
print("PASS")
} else {
print("FAIL")
stop("Test failed")
}
}
unittesttol <- function(x,y,z) {
if (all(abs(x-y) < z)) {
print("PASS")
} else {
print("FAIL")
stop("Test failed")
}
}