tests/testthat/test_state_names.R

context("state_names")
test_that(
    desc = "understands the default value of names = TRUE", {
        x = 1:100
        expect_equal(
            attr(SampleQuantiles$new(x)$qx(), "names"), "50%"
        )
    }
)
test_that(
    desc = "understands the user input value of names = TRUE", {
        x = 1:100
        expect_equal(
            attr(
                SampleQuantiles$new(x, probs = 0.70, names = TRUE)$qx(),
                "names"
                ),
            "70%"
        )
    }
)
test_that(
    desc = "understands the user input value of names = FALSE", {
        x = 1:100
        expect_null(
            attr(
                SampleQuantiles$new(x, probs = 0.70, names = FALSE)$qx(),
                "names"
            )
        )
    }
)

Try the cvcqv package in your browser

Any scripts or data that you put into this service are public.

cvcqv documentation built on Aug. 6, 2019, 5:10 p.m.