tests/testthat/test-cagr.R

context("Calculating rate of return for an investment")

test_that("compound annual growth rate calculates correctly", {
    expect_equal(cagr(1000, 2200, 4), 0.21788, tolerance = 1e-3)
})
bclark86/clarklytics documentation built on Oct. 4, 2020, 12:14 a.m.