https://github.com/cran/pracma
Raw File
Tip revision: e2512490ec9e26c0bfb230f9fd97bcf07cc8c07b authored by Hans W. Borchers on 10 November 2023, 00:10:02 UTC
version 2.4.4
Tip revision: e251249
poly.R
###
### Poly.R  +++ Test suite +++
###


test.Poly <- function(input, expected) {
   output <- do.call(getFromNamespace("Poly", "pracma"), input)
   identical(output, expected)
}

Poly.expected.empty  <- 1
Poly.expected.1 <- c(1, -6, 11, -6)
#Poly.expected.2 <- error
Poly.expected.3 <- c(1, 0, 0, 0, -1)
Poly.expected.4 <- c(1, -10, 35, -50, 24)
Poly.expected.5 <- c(1, -4, 6, -4, 1)
Poly.expected.6 <- c(1, -5)

test.Poly(list(x=c()), Poly.expected.empty)
test.Poly(list(x=c(1,2,3)), Poly.expected.1)
#test.Poly(list(x=matrix(1:6, 2, 3)), Poly.expected.2)
test.Poly(list(x=c(1,-1,1i,-1i)), Poly.expected.3)
test.Poly(list(x=c(1,2,3,4)), Poly.expected.4)
test.Poly(list(x=diag(4)), Poly.expected.5)
test.Poly(list(x=5), Poly.expected.6)
back to top