https://github.com/cran/pracma
Tip revision: a7001ff1805634d18a10fa371b38dbe3e48f8c9e authored by HwB on 30 October 2011, 00:00:00 UTC
version 0.8.1
version 0.8.1
Tip revision: a7001ff
trapz.R
###
### trapz.R +++ Test suite +++
###
test.trapz <- function(input, expected) {
output <- do.call(getFromNamespace("trapz", "pracma"), input)
identical(output, expected)
}
trapz.expected.empty1 <- 0
trapz.expected.empty2 <- 0
trapz.expected.gen1 <- 12
trapz.expected.gen2 <- 6
trapz.expected.cmpl1 <- 0+0.5i
trapz.expected.cmpl2 <- 0+0.5i
test.trapz(list(x=c()), trapz.expected.empty1)
test.trapz(list(x=c(), y=c()), trapz.expected.empty2)
test.trapz(list(x=1:5), trapz.expected.gen1)
test.trapz(list(x=seq(0,2,by=0.5), y=1:5), trapz.expected.gen2)
test.trapz(list(x=c(0,1), y=c(0,1i)), trapz.expected.cmpl1)
test.trapz(list(x=c(0,1i), y=c(0,1)), trapz.expected.cmpl2)