R Under development (unstable) (2024-08-23 r87049 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. > ################################################################################ > ## > ## $Id: portfolio.create.test.R 1625 2010-02-18 19:44:29Z enos $ > ## > ## Tests "create" method of "portfolio" class > ## > ################################################################################ > > library(portfolio) Loading required package: grid Loading required package: lattice > > load("portfolio.create.test.RData") > > ## save(data.0, p.0, price, truth, file = "portfolio.create.test.RData", compress = TRUE) > > ## Test checks that "create" method updates "shares" slot of > ## "portfolio". > > ## erases work done by "create" method by excising data from > ## the "shares" data.frame > > p.0@shares <- p.0@shares[0,] > > ## "create" method attempts to rebuild "shares" data.frame > > trial.0 <- try( + all.equal( + truth$shares, + create(p.0)@shares$shares + ), + silent = TRUE + ) > > if(class(trial.0) == "try-error"){ + stop("create method failed to update shares data.frame!") + } > > proc.time() user system elapsed 0.37 0.09 0.45