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. > ### > ### polyarea.R +++ Test suite +++ > ### > > > test.polyarea <- function(input, expected) { + output <- do.call(getFromNamespace("polyarea", "pracma"), input) + identical(output, expected) + } > > polyarea.expected.empty <- 0 > polyarea.expected.gen1 <- 3.5 > polyarea.expected.gen2 <- 4 > polyarea.expected.mtrx <- c(4, 4) > polyarea.expected.cmpl <- 0.5 > > test.polyarea(list(x=c(), y=c()), polyarea.expected.empty) [1] TRUE > test.polyarea(list(x=c(0,2,2,1,0), y=c(0,-1,2,1,1)), polyarea.expected.gen1) [1] TRUE > test.polyarea(list(x=matrix(c(1,1,3,3,1), 5, 1), + y=matrix(c(1,3,3,1,1), 5, 1)), + polyarea.expected.gen2) [1] FALSE > test.polyarea(list(x=matrix(c(1,3,3,1,1,1,3,3), 4, 2), + y=matrix(c(1,1,3,3,1,3,3,1), 4, 2)), + polyarea.expected.mtrx) [1] FALSE > test.polyarea(list(x=c(0,1,1,0), y=c(0,0,1i,0)), polyarea.expected.cmpl) [1] FALSE > > proc.time() user system elapsed 0.12 0.06 0.17