Skip to content

Commit

Permalink
add_test
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlotte1031 committed Sep 9, 2024
1 parent 95bd83a commit 6154bbd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/testthat/test-ea1c.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
test_data = c(100, 120, 150, 200) # col 'gl'
test_id = 'test 1' # col 'id'
test_df <- data.frame(id = test_id, gl = test_data)

test_out <- test_df %>%
dplyr::group_by(id) %>%
dplyr::summarise(
eA1C = (46.7+mean(gl, na.rm = TRUE) )/28.7
)

test_out$id = NULL

result =
test_that("iglu::ea1c == base::ea1c", {
expect_equal(iglu::ea1c(test_data), test_out , tolerance = 0.0001)
})
3 changes: 3 additions & 0 deletions tests/testthat/test-grade.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test_that("multiplication works", {
expect_equal(2 * 2, 4)
})

0 comments on commit 6154bbd

Please sign in to comment.