R Under development (unstable) (2024-02-17 r85935 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 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. > library("splus2R") > > # Basic test > testFile <- "do.test.t" > do.test(testFile) ------- Test file: do.test.t --------- NULL [1] FALSE NULL [1] "Mean relative difference: 1" NULL [1] "Mean relative difference: 2" NULL [1] FALSE NULL [1] "Error in eval(E[[I]], envir = Env) : This is a stop\n" attr(,"class") [1] "try-error" attr(,"condition") NULL [1] FALSE Warning message: In eval(E[[I]], envir = Env) : This is a warning > > # Test verbose=TRUE > do.test(testFile, verbose=TRUE) ------- Test file: do.test.t --------- NULL [1] TRUE NULL [1] FALSE NULL [1] TRUE NULL [1] "Mean relative difference: 1" NULL [1] "Mean relative difference: 2" NULL [1] TRUE NULL [1] FALSE NULL [1] "Error in eval(E[[I]], envir = Env) : This is a stop\n" attr(,"class") [1] "try-error" attr(,"condition") NULL [1] FALSE Warning message: In eval(E[[I]], envir = Env) : This is a warning > > # Test strict=TRUE > try( + do.test(testFile, strict=TRUE) + ) # Need try() to prevent R CMD check problems ------- Test file: do.test.t --------- NULL [1] FALSE Error in do.test(testFile, strict = TRUE) : Test Failed > > # Test check argument > do.test(testFile, check = Quote(print("......."))) ------- Test file: do.test.t --------- [1] "......." [1] "......." NULL [1] FALSE [1] "......." [1] "......." NULL [1] "Mean relative difference: 1" [1] "......." NULL [1] "Mean relative difference: 2" [1] "......." [1] "......." NULL [1] FALSE [1] "......." NULL [1] "Error in eval(E[[I]], envir = Env) : This is a stop\n" attr(,"class") [1] "try-error" attr(,"condition") [1] "......." NULL [1] FALSE Warning message: In eval(E[[I]], envir = Env) : This is a warning > > # Test use of a connection, as opposed to a file. > testConnection <- file(testFile, open="r") > do.test(testConnection) ---- Test connection: do.test.t Class: file connection ---- NULL [1] FALSE NULL [1] "Mean relative difference: 1" NULL [1] "Mean relative difference: 2" NULL [1] FALSE NULL [1] "Error in eval(E[[I]], envir = Env) : This is a stop\n" attr(,"class") [1] "try-error" attr(,"condition") NULL [1] FALSE Warning message: In eval(E[[I]], envir = Env) : This is a warning > > > > #-------------------------------------------------- > # Test removal of objects > > # Test effect of creating but not removing objects ("x") > testFile2 <- "createObjects.t" > do.test(testFile2) ------- Test file: createObjects.t --------- > x [1] 1 > # x should exist in the working environment > exists("x", envir = .GlobalEnv) [1] TRUE > if(exists("x", envir = .GlobalEnv)) + rm(x, envir = .GlobalEnv) > > > do.test(testFile2, local=TRUE) ------- Test file: createObjects.t --------- > (!exists("x", envir = .GlobalEnv)) [1] TRUE > # x should not exist in the working environment > > > > # Test: (1) removal of objects (2) whether objects created are used > x <- 55 # set to 5 in the function; if 5 then tests should pass > testFile3 <- "useObjects.t" > do.test(testFile3) ------- Test file: useObjects.t --------- > (!exists("x", envir = .GlobalEnv)) [1] TRUE > # x should not exist in the working environment > > x <- 55 # set to 5 in the function; if 5 then tests should pass > do.test(testFile3, local=TRUE) ------- Test file: useObjects.t --------- > all.equal(x, 55) # is 55 in R [1] TRUE > exists("x", envir = .GlobalEnv) && identical(x, 55) [1] TRUE > if(exists("x", envir = .GlobalEnv)) + rm(x, envir = .GlobalEnv) > > > #-------------------------------------------------- > # Test auxiliary functions > > # Test the use of allTrue > testFile4 <- "allTrue.t" > do.test(testFile4) ------- Test file: allTrue.t --------- NULL $`Comparison 2` [1] "Mean relative difference: 1" > > > # Test the use of all.equal.excluding > testFile5 <- "all.equal.excluding.t" > do.test(testFile5) ------- Test file: all.equal.excluding.t --------- NULL [1] "Component \"call\": target, current do not match when deparsed" NULL NULL > > proc.time() user system elapsed 0.32 0.06 0.37