context("test-r-tdee.R")
test_that("tdee calculations are correct", {
expect_equal(calculate_tdee(
rmr = 2100,
objective = 1,
effort = 1.5
), 3150)
# Objective is too high
expect_error(calculate_tdee(
rmr = 2100,
objective = 0.7,
effort = 0.7
))
# Objective is too low
expect_error(calculate_tdee(
rmr = 2100,
objective = 0.7,
effort = 1.4
))
# Effort is too high
expect_error(calculate_tdee(
rmr = 2100,
objective = 1,
effort = 2.0
))
# Effort is too low
expect_error(calculate_tdee(
rmr = 2100,
objective = 1,
effort = 0.9
))
})
test_that("calculate_mean_tdee works like it should", {
expect_true(is.data.frame(
calculate_mean_tdee(
weight = 80,
height = 187,
age = 27,
sex = "male",
bfp = 14,
objective = 1,
effort = 1.4
)
))
expect_equal(
class(
calculate_mean_tdee(
weight = 80,
height = 187,
age = 27,
sex = "male",
bfp = 14,
objective = 1,
effort = 1.4
)
),
c("tbl_df", "tbl", "data.frame")
)
expect_equal(
calculate_mean_tdee(
weight = 80,
height = 187,
age = 27,
sex = "male",
bfp = 14,
objective = 1,
effort = 1.4
),
structure(
list(
Equation = c(
"mifflin",
"harris-benedict",
"revised-harris-benedict",
"katch-mcardle",
"katch-mcardle-hybrid",
"cunningham",
"mean"
),
TDEE = c(
2574.25, 2687.77, 2665.96, 2598.51, 2622.74, 2819.04,
2661.38
)
),
class = c("tbl_df", "tbl", "data.frame"),
row.names = c(
NA,
-7L
)
)
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.