R Under development (unstable) (2023-11-08 r85496 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. > ### > ### pow2.R +++ Test suite +++ > ### > > > test.pow2 <- function(input, expected) { + output <- do.call(getFromNamespace("pow2", "pracma"), input) + identical(output, expected) + } > > pow2.expected.00 <- 0 > pow2.expected.m1 <- -0.5 > pow2.expected.f <- c(1, 2, 4, 8) > pow2.expected.fe <- c(0, 0.5, -8, 24) > pow2.expected.c <- c(2^(1i), 2^(-1i)) > > test.pow2(list(f=0, e=0), pow2.expected.00) [1] TRUE > test.pow2(list(f=-1, e=-1), pow2.expected.m1) [1] TRUE > test.pow2(list(f=c(0,1,2,3)), pow2.expected.f) [1] TRUE > test.pow2(list(f=c(0,1,-2,3), e=c(0,-1,2,3)), pow2.expected.fe) [1] TRUE > test.pow2(list(f=c(1i, -1i)), pow2.expected.c) [1] TRUE > > proc.time() user system elapsed 0.12 0.06 0.17