tests/testthat/test_hei.R

context("HEI calculation")

test_that("HEI score is same as original validation data", {

    diet <- get_diet("2009/2010", "both")
    fped <- get_fped("2009/2010", "both")
    demog <- get_demo("2009/2010")

    heires <- hei(fped,diet,demog)

    expect_equal_to_reference(heires$HEI, file = "rds/valid.rds")

})

test_that("HEI verbose argument returns all columns", {

    diet <- get_diet("2009/2010", "both")
    fped <- get_fped("2009/2010", "both")
    demog <- get_demo("2009/2010")

    heires <- hei(fped,diet, demog, verbose = TRUE)

    expect_equal(ncol(heires), 70)

})

Try the hei package in your browser

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

hei documentation built on Aug. 18, 2017, 1:03 a.m.