https://github.com/cran/pracma
Revision 267abaa96cae63dd7872bb21b2613bd067b0a9f4 authored by Hans W. Borchers on 30 January 2018, 13:20:01 UTC, committed by cran-robot on 30 January 2018, 13:20:01 UTC
1 parent fdf1669
Tip revision: 267abaa96cae63dd7872bb21b2613bd067b0a9f4 authored by Hans W. Borchers on 30 January 2018, 13:20:01 UTC
version 2.1.4
version 2.1.4
Tip revision: 267abaa
nextpow2.R
###
### nextpow2.R +++ Test suite +++
###
test.nextpow2 <- function(input, expected) {
output <- do.call(getFromNamespace("nextpow2", "pracma"), input)
identical(output, expected)
}
nextpow2.expected.empty <- NULL
nextpow2.expected.0 <- 0
nextpow2.expected.vector <- c(0, 1, 2, 2, 3, 3, 3, 3, 4, 4)
nextpow2.expected.matrix <- matrix(c(0, 1, 1, 0), 2, 2)
nextpow2.expected.16 <- 4
nextpow2.expected.m16 <- 4
nextpow2.expected.m6 <- -19
nextpow2.expected.mq <- -2
test.nextpow2(list(x=c()), nextpow2.expected.empty)
test.nextpow2(list(x=0), nextpow2.expected.0)
test.nextpow2(list(x=1:10), nextpow2.expected.vector)
test.nextpow2(list(x=matrix(c(1i, 2i, 2+0i, 0+0i), 2, 2)),
nextpow2.expected.matrix)
test.nextpow2(list(x=16), nextpow2.expected.16)
test.nextpow2(list(x=-16), nextpow2.expected.m16)
test.nextpow2(list(x=1e-6), nextpow2.expected.m6)
test.nextpow2(list(x=-0.25), nextpow2.expected.mq)
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...