R Under development (unstable) (2023-11-26 r85638 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. > ## unit tests will not be done if RUnit is not available > if(require("RUnit", quietly=TRUE)) { + + ## --- Setup --- + R_CMD_CHECK <- Sys.getenv("RCMDCHECK") != "FALSE" + + pkg <- "TTR" # <-- Change to package name! + + if (R_CMD_CHECK) { + ## Path to unit tests for R CMD check + ## PKG.Rcheck/PKG/unitTests + path <- system.file("unitTests", package=pkg) + } else { + ## Path to unit tests for standalone running under Makefile (not R CMD check) + ## PKG/tests/../inst/unitTests + path <- file.path(getwd(), "..", "inst", "unitTests") + } + cat("\nRunning unit tests\n") + print(list(pkg=pkg, getwd=getwd(), pathToUnitTests=path)) + + library(package=pkg, character.only=TRUE) + + ## If desired, load the name space to allow testing of private functions + ## if (is.element(pkg, loadedNamespaces())) + ## attach(loadNamespace(pkg), name=paste("namespace", pkg, sep=":"), pos=3) + ## + ## or simply call PKG:::myPrivateFunction() in tests + + ## --- Testing --- + + ## Define tests + testSuite <- defineTestSuite(name=paste(pkg, "unit testing"), + dirs=path) + ## Run + tests <- runTestSuite(testSuite) + + ## Report to stdout + cat("------------------- UNIT TEST SUMMARY ---------------------\n\n") + printTextProtocol(tests, showDetails=FALSE) + + ## Report text files (only if not under R CMD check) + if (!R_CMD_CHECK) { + ## Default report name + pathReport <- file.path(path, "report") + + printTextProtocol(tests, showDetails=FALSE, + fileName=paste(pathReport, "Summary.txt", sep="")) + printTextProtocol(tests, showDetails=TRUE, + fileName=paste(pathReport, ".txt", sep="")) + + ## Report to HTML file + printHTMLProtocol(tests, fileName=paste(pathReport, ".html", sep="")) + } + + ## Return stop() to cause R CMD check stop in case of + ## - failures i.e. FALSE to unit tests or + ## - errors i.e. R errors + testErrors <- getErrors(tests) + if(testErrors$nFail > 0) { + msg <- paste0(" unit test", if(testErrors$nFail > 1) "s" else "", " failed") + stop("\n", testErrors$nFail, msg, sep="") + } + if(testErrors$nErr > 0) { + msg <- paste0(" unit test", if(testErrors$nErr > 1) "s" else "", " had errors") + stop("\n", testErrors$nErr, msg, sep="") + } + if (testErrors$nTestFunc < 1) { + stop("No test functions ran!") + } + } else { + warning("cannot run unit tests -- package RUnit is not available") + } Running unit tests $pkg [1] "TTR" $getwd [1] "d:/RCompile/CRANincoming/R-devel/TTR.Rcheck/tests" $pathToUnitTests [1] "D:/temp/RtmpcZqOkc/RLIBS_2fe7c168c7a14/TTR/unitTests" Executing test function test.correct_column_names ... done successfully. Executing test function test.CLV ... done successfully. Executing test function test.CTI ... done successfully. Executing test function test.EMV ... done successfully. Executing test function test.KST ... done successfully. Executing test function test.ROC.continuous ... done successfully. Executing test function test.ROC.discrete ... done successfully. Executing test function test.momentum ... done successfully. Executing test function test.ALMA.output.length.eq.input.length ... done successfully. Executing test function test.DEMA ... Error in DEMA(input$mid$Close) : Series contains non-leading NAs In addition: Warning messages: 1: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry 3: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 4: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry 5: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 6: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry Error in DEMA(input$all[, 1:2]) : ncol(x) > 1. DEMA only supports univariate 'x' done successfully. Executing test function test.EMA ... Error in EMA(input$mid$Close) : Series contains non-leading NAs Error in EMA(input$all[, 1:2]) : ncol(x) > 1; EMA only supports univariate 'x' Error in EMA(input$all$Close, n = -1) : n = -1 is outside valid range: [1, 250] Error in EMA(input$all$Close, n = NROW(input$all) + 1) : n = 251 is outside valid range: [1, 250] done successfully. Executing test function test.EMA.n.ratio ... done successfully. Executing test function test.EMA.non.na.eq.n.does.not.error ... done successfully. Executing test function test.EMA.ratio.eq.0 ... Error in EMA(1:10, ratio = 0) : either 'n' or 'ratio' must be specified and > 0 'n' is -2147483648 and 'ratio' is 0.000000 In addition: Warning message: In EMA(1:10, n = 3, ratio = 0.5) : both 'n' and 'ratio' are specified; using 'n' done successfully. Executing test function test.EMA.wilder ... Error in EMA(input$mid$Close, wilder = TRUE) : Series contains non-leading NAs done successfully. Executing test function test.EVWMA ... Error in EVWMA(input$mid$Close, input$mid$Volume) : Series contains non-leading NAs Error in EVWMA(input$all$Close) : argument "volume" is missing, with no default Error in EVWMA(input$all[, 1:2], input$all$Volume) : ncol(price) > 1 or ncol(volume) > 1. EVWMA only supports univariate 'price' and 'volume' Error in EVWMA(input$all$Close, input$all[, 1:2]) : ncol(price) > 1 or ncol(volume) > 1. EVWMA only supports univariate 'price' and 'volume' Error in EVWMA(input$all$Close, n = -1) : argument "volume" is missing, with no default Error in EVWMA(input$all$Close, n = NROW(input$all) + 1) : argument "volume" is missing, with no default done successfully. Executing test function test.HMA ... done successfully. Executing test function test.HMA.odd.n ... done successfully. Executing test function test.SMA ... Error in runSum(x, n) : Series contains non-leading NAs Error in runSum(x, n) : ncol(x) > 1. runSum only supports univariate 'x' done successfully. Executing test function test.WMA ... Error in WMA(input$mid$Close) : 'x' contains non-leading NAs Error in WMA(input$all$Close, wts = 1) : Length of 'wts' must equal the length of 'x' or 'n' Error in WMA(input$all[, 1:2]) : ncol(x) > 1 or ncol(wts) > 1. WMA only supports univariate 'x' and 'w' Error in WMA(input$all$Close, n = -1) : Length of 'wts' must equal the length of 'x' or 'n' Error in WMA(input$all$Close, n = NROW(input$all) + 1) : n = 251 is outside valid range: [1, 250] done successfully. Executing test function test.WMA_returns_xts ... done successfully. Executing test function test.WMAvol ... Error in WMA(input$all$Close, wts = input$mid$Volume) : 'wts' contains non-leading NAs Error in WMA(input$all[, 1:2], wts = input$all$Volume) : ncol(x) > 1 or ncol(wts) > 1. WMA only supports univariate 'x' and 'w' Error in WMA(input$all$Close, wts = input$all[, 1:2]) : ncol(x) > 1 or ncol(wts) > 1. WMA only supports univariate 'x' and 'w' done successfully. Executing test function test.ZLEMA ... Error in ZLEMA(input$mid$Close) : Series contains non-leading NAs Error in ZLEMA(input$all[, 1:2]) : ncol(x) > 1. ZLEMA only supports univariate 'x' done successfully. Executing test function test.ZLEMA.n.ratio ... done successfully. Executing test function test.ZLEMA.ratio.eq.0 ... Error in ZLEMA(1:10, ratio = 0) : either 'n' or 'ratio' must be specified and > 0 'n' is -2147483648 and 'ratio' is 0.000000 In addition: Warning message: In ZLEMA(1:10, n = 7, ratio = 0.25) : both 'n' and 'ratio' are specified; using 'n' done successfully. Executing test function test.CMO ... Error in runSum(up, n) : Series contains non-leading NAs In addition: Warning messages: 1: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry done successfully. Executing test function test.DPO ... Error in runSum(x, n) : Series contains non-leading NAs done successfully. Executing test function test.MACD ... Error in EMA(c(3.08, 3.11, 3.09, 3.1, 3.11, 3.16, 3.22, 3.23, NA, NA, : Series contains non-leading NAs done successfully. Executing test function test.RSI ... Error in EMA(c(NA, 0.0299999999999998, 0, 0.0100000000000002, 0.00999999999999979, : Series contains non-leading NAs done successfully. Executing test function test.RSI.does.not.overwrite.maArgs ... done successfully. Executing test function test.SMI ... Error in runMax(high, n) : Series contains non-leading NAs done successfully. Executing test function test.TRIX ... Error in EMA(c(3.08, 3.11, 3.09, 3.1, 3.11, 3.16, 3.22, 3.23, NA, NA, : Series contains non-leading NAs done successfully. Executing test function test.WPR ... Error in runMax(high, n) : Series contains non-leading NAs done successfully. Executing test function test.stoch ... Error in runMax(high, nFastK) : Series contains non-leading NAs done successfully. Executing test function test.stoch.for.Inf.fastK ... done successfully. Executing test function test.ultimateOscillator ... Error in HLC[-NROW(HLC), 3] : subscript out of bounds done successfully. Executing test function test.ultimateOscillator.monthly.xts ... done successfully. Executing test function test.BBands ... Error in BBands(im) : Price series must be either High-Low-Close, or Close/univariate. In addition: Warning messages: 1: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry done successfully. Executing test function test.SAR ... Error in naCheck(HL, 0) : Series contains non-leading NAs done successfully. Executing test function test.ZigZag ... Error in naCheck(HL, 0) : Series contains non-leading NAs done successfully. Executing test function test.ADX ... done successfully. Executing test function test.ADX.does.not.overwrite.maArgs ... done successfully. Executing test function test.ATR.does.not.overwrite.maArgs ... done successfully. Executing test function test.ATR.orig ... done successfully. Executing test function test.ATR.xts ... done successfully. Executing test function test.CCI ... done successfully. Executing test function test.TDI ... done successfully. Executing test function test.VHF ... done successfully. Executing test function test.aroon.non.na.eq.n.does.not.error ... done successfully. Executing test function test.aroon.orig ... done successfully. Executing test function test.aroon.xts ... done successfully. Executing test function test.Close ... Error in runCov(x, x, n, use = "all.obs", sample = sample, cumulative) : Series contains non-leading NAs In addition: Warning messages: 1: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry 3: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 4: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry done successfully. Executing test function test.chaikin ... done successfully. Executing test function test.garman.klass ... Error in runSum(0.5 * log(OHLC[, 2]/OHLC[, 3])^2 - (2 * log(2) - 1) * : Series contains non-leading NAs done successfully. Executing test function test.parkinson ... Error in runSum(log(OHLC[, 2]/OHLC[, 3])^2, n) : Series contains non-leading NAs done successfully. Executing test function test.rogers.satchell ... Error in runSum(log(OHLC[, 2]/OHLC[, 4]) * log(OHLC[, 2]/OHLC[, 1]) + : Series contains non-leading NAs done successfully. Executing test function test.CMF ... Error in runSum(clv * volume, n) : Series contains non-leading NAs In addition: Warning messages: 1: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry Error in runSum(clv * volume, n) : Series contains non-leading NAs Error in runSum(clv * volume, n) : Series contains non-leading NAs done successfully. Executing test function test.MFI ... Error in runSum(pmf, n) : Series contains non-leading NAs Error in runSum(pmf, n) : Series contains non-leading NAs Error in runSum(pmf, n) : Series contains non-leading NAs done successfully. Executing test function test.MFI.when.volume.does.not.change ... done successfully. Executing test function test.OBV ... done successfully. Executing test function test.chaikinAD ... done successfully. Executing test function test.williamsAD ... done successfully. Executing test function test.runCor ... Error in runCov(x, y, n, use = use, sample = sample, cumulative) : Series contains non-leading NAs In addition: Warning messages: 1: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry Error in runCor(input$all$High) : argument "y" is missing, with no default Error in runCov(x, y, n, use = use, sample = sample, cumulative) : ncol(x) > 1 or ncol(y) > 1. runCov only supports univariate 'x' and 'y' Error in runCor(input$all$Close, n = -1) : argument "y" is missing, with no default Error in runCor(input$all$Close, n = NROW(input$all) + 1) : argument "y" is missing, with no default done successfully. Executing test function test.runCov ... Error in runCov(input$mid$High, input$mid$Low) : Series contains non-leading NAs Error in runCov(input$all$High) : argument "y" is missing, with no default Error in runCov(input$all[, 1:2], input$all$Low) : ncol(x) > 1 or ncol(y) > 1. runCov only supports univariate 'x' and 'y' Error in runCov(input$all$Close, n = -1) : argument "y" is missing, with no default Error in runCov(input$all$Close, n = NROW(input$all) + 1) : argument "y" is missing, with no default done successfully. Executing test function test.runCov.cumulative ... done successfully. Executing test function test.runCov.n.1.and.cumulative.FALSE.warns ... Error in runCov(1:10, 1:10, n = 1, cumulative = FALSE) : (converted from warning) (co-)variance is not defined for one observation; returning NA done successfully. Executing test function test.runCov.xts.nonleading.na ... Error in runCov(top, mid) : Series contains non-leading NAs done successfully. Executing test function test.runMAD ... Error in runMedian(x, n, cumulative = cumulative) : Series contains non-leading NAs Error in runMAD(input$all[, 1:2]) : ncol(x) > 1. runMAD only supports univariate 'x' Error in runMAD(input$all$Close, n = -1) : n = -1 is outside valid range: [1, 250] Error in runMAD(input$all$Close, n = NROW(input$all) + 1) : n = 251 is outside valid range: [1, 250] done successfully. Executing test function test.runMAD.cumulative ... done successfully. Executing test function test.runMAD.cumulative.leading.NA ... done successfully. Executing test function test.runMax ... Error in runMax(input$mid$Close) : Series contains non-leading NAs Error in runMax(input$all[, 1:2]) : ncol(x) > 1. runMax only supports univariate 'x' Error in runMax(input$all$Close, n = -1) : n = -1 is outside valid range: [1, 250] Error in runMax(input$all$Close, n = NROW(input$all) + 1) : n = 251 is outside valid range: [1, 250] done successfully. Executing test function test.runMax.cumulative ... done successfully. Executing test function test.runMean ... Error in runSum(x, n) : Series contains non-leading NAs Error in runSum(x, n) : ncol(x) > 1. runSum only supports univariate 'x' Error in runSum(x, n) : n = -1 is outside valid range: [1, 250] Error in runSum(x, n) : n = 251 is outside valid range: [1, 250] done successfully. Executing test function test.runMean.cumulative ... done successfully. Executing test function test.runMean.cumulative.accounts.for.leading.NA ... done successfully. Executing test function test.runMean.cumulative.n.equals.1 ... done successfully. Executing test function test.runMedian ... Error in runMedian(input$mid$Close) : Series contains non-leading NAs Error in runMedian(input$all[, 1:2]) : ncol(x) > 1. runMedian only supports univariate 'x' Error in runMedian(input$all$Close, n = -1) : n = -1 is outside valid range: [1, 250] Error in runMedian(input$all$Close, n = NROW(input$all) + 1) : n = 251 is outside valid range: [1, 250] done successfully. Executing test function test.runMedian.cumulative ... done successfully. Executing test function test.runMedian.cumulative.leading.NA ... done successfully. Executing test function test.runMedian.cumulative.n.equals.1 ... done successfully. Executing test function test.runMin ... Error in runMin(input$mid$Close) : Series contains non-leading NAs Error in runMin(input$all[, 1:2]) : ncol(x) > 1. runMin only supports univariate 'x' Error in runMin(input$all$Close, n = -1) : n = -1 is outside valid range: [1, 250] Error in runMin(input$all$Close, n = NROW(input$all) + 1) : n = 251 is outside valid range: [1, 250] done successfully. Executing test function test.runMin.cumulative ... done successfully. Executing test function test.runPercentRank_cumulTRUE_exact.multiplier_eq0 ... done successfully. Executing test function test.runPercentRank_cumulTRUE_exact.multiplier_eq0.5 ... done successfully. Executing test function test.runPercentRank_cumulTRUE_exact.multiplier_eq1 ... done successfully. Executing test function test.runPercentRank_exact.multiplier_bounds ... Error in sprintf("exact.multiplier = %d is outside valid range: [0, 1]", : invalid format '%d'; use format %f, %e, %g or %a for numeric objects Error in sprintf("exact.multiplier = %d is outside valid range: [0, 1]", : invalid format '%d'; use format %f, %e, %g or %a for numeric objects done successfully. Executing test function test.runPercentRank_exact.multiplier_eq0 ... done successfully. Executing test function test.runPercentRank_exact.multiplier_eq0.5 ... done successfully. Executing test function test.runPercentRank_exact.multiplier_eq1 ... done successfully. Executing test function test.runSD ... Error in runCov(x, x, n, use = "all.obs", sample = sample, cumulative) : Series contains non-leading NAs Error in runCov(x, x, n, use = "all.obs", sample = sample, cumulative) : ncol(x) > 1 or ncol(y) > 1. runCov only supports univariate 'x' and 'y' Error in runCov(x, x, n, use = "all.obs", sample = sample, cumulative) : n = -1 is outside valid range: [1, 250] Error in runCov(x, x, n, use = "all.obs", sample = sample, cumulative) : n = 251 is outside valid range: [1, 250] done successfully. Executing test function test.runSD.cumulative.with.leading.NA ... done successfully. Executing test function test.runSum ... Error in runSum(input$mid$Close) : Series contains non-leading NAs Error in runSum(input$all[, 1:2]) : ncol(x) > 1. runSum only supports univariate 'x' Error in runSum(input$all$Close, n = -1) : n = -1 is outside valid range: [1, 250] Error in runSum(input$all$Close, n = NROW(input$all) + 1) : n = 251 is outside valid range: [1, 250] done successfully. Executing test function test.runVar ... Error in runCov(x, y, n, use = "all.obs", sample = sample, cumulative) : Series contains non-leading NAs Error in runCov(x, y, n, use = "all.obs", sample = sample, cumulative) : ncol(x) > 1 or ncol(y) > 1. runCov only supports univariate 'x' and 'y' Error in runCov(x, y, n, use = "all.obs", sample = sample, cumulative) : n = -1 is outside valid range: [1, 250] Error in runCov(x, y, n, use = "all.obs", sample = sample, cumulative) : n = 251 is outside valid range: [1, 250] done successfully. Executing test function test.wilderSum ... Error in naCheck(x, n) : Series contains non-leading NAs Error in wilderSum(input$all[, 1:2]) : ncol(x) > 1. wilderSum only supports univariate 'x' Error in wilderSum(input$all$Close, n = -1) : n = -1 is outside valid range: [1, 250] Error in wilderSum(input$all$Close, n = NROW(input$all) + 1) : n = 251 is outside valid range: [1, 250] done successfully. ------------------- UNIT TEST SUMMARY --------------------- RUNIT TEST PROTOCOL -- Tue Nov 28 01:21:16 2023 *********************************************** Number of test functions: 94 Number of errors: 0 Number of failures: 0 1 Test Suite : TTR unit testing - 94 test functions, 0 errors, 0 failures > > proc.time() user system elapsed 2.81 0.21 3.01