Skip to content

Commit

Permalink
Add unit tests for MA function colnames
Browse files Browse the repository at this point in the history
See #131.
  • Loading branch information
joshuaulrich committed Feb 13, 2024
1 parent 001c4da commit 6add5d9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions inst/unitTests/runit.TTR.MovingAverages.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,17 @@ test.EMA.non.na.eq.n.does.not.error <- function() {
return(TRUE)
}

test.ma.on.xts.objects.have.colnames <- function() {
x <- xts::as.xts(ttrc)
p <- x[, "Close"]
v <- x[, "Volume"]
checkEquals("SMA", colnames(SMA(p)))
checkEquals("EMA", colnames(EMA(p)))
checkEquals("DEMA", colnames(DEMA(p)))
checkEquals("WMA", colnames(WMA(p)))
checkEquals("EVWMA", colnames(EVWMA(p, v)))
checkEquals("ZLEMA", colnames(ZLEMA(p)))
checkEquals("VWAP", colnames(VWAP(p, v)))
checkEquals("HMA", colnames(HMA(p)))
checkEquals("ALMA", colnames(ALMA(p)))
}

0 comments on commit 6add5d9

Please sign in to comment.