tests/testthat/test_freq_out.R

test_that('freq_out gives a frequency table', {
        # Success test 1
        ychk <- as.data.frame(table(iris$Species))
        yfun <- freq_out(iris$Species)
        expect_identical(TRUE, all(ychk==yfun))

        # Failure test 1
        expect_error(freq_out(c(2)),'Input is a scalar; cannot be tabulated')

        # Failure test 2
        expect_error(freq_out(iris),'Input is not an atomic type')
})
KPdir/foofactors documentation built on May 8, 2019, 4:41 p.m.