swh:1:snp:81eadaa089e8253d8469bcef66aa332632c6c669
Tip revision: 9a644c12884525087aa1db3ecf57586b29fb17d8 authored by HwB on 06 June 2011, 00:00:00 UTC
version 0.5-3
version 0.5-3
Tip revision: 9a644c1
nthroot.R
###
### NTHROOT.R +++ Test suite +++
###
test.nthroot <- function(input, expected) {
output <- do.call(getFromNamespace("nthroot", "pracma"), input)
identical(output, expected)
}
nthroot.expected.n0 <- c(-1.2)
nthroot.expected.n1 <- c(1, -2, 3)
nthroot.expected.n2 <- c(1, 0, 3)
nthroot.expected.n3 <- c(1, -2, 3)
test.nthroot(list(x=-1.2^5, n=5), nthroot.expected.n0)
test.nthroot(list(x=c(1,-2, 3), n=1), nthroot.expected.n1)
test.nthroot(list(x=c(1, 0, 9), n=2), nthroot.expected.n2)
test.nthroot(list(x=c(1,-8,27), n=3), nthroot.expected.n3)