R Under development (unstable) (2023-11-07 r85491 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit 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) [1] TRUE > test.nextpow2(list(x=0), nextpow2.expected.0) [1] TRUE > test.nextpow2(list(x=1:10), nextpow2.expected.vector) [1] TRUE > test.nextpow2(list(x=matrix(c(1i, 2i, 2+0i, 0+0i), 2, 2)), + nextpow2.expected.matrix) [1] TRUE > test.nextpow2(list(x=16), nextpow2.expected.16) [1] TRUE > test.nextpow2(list(x=-16), nextpow2.expected.m16) [1] TRUE > test.nextpow2(list(x=1e-6), nextpow2.expected.m6) [1] TRUE > test.nextpow2(list(x=-0.25), nextpow2.expected.mq) [1] TRUE > > proc.time() user system elapsed 0.15 0.03 0.17