Skip to content

Commit

Permalink
reupload hall data and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LylChun committed Nov 30, 2023
1 parent 9e80282 commit c36c4bc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 26 deletions.
Binary file added data/example_data_hall.rda
Binary file not shown.
Binary file added data/example_meals_hall.rda
Binary file not shown.
51 changes: 25 additions & 26 deletions tests/testthat/test-meals.R
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
# # Test on one subject data
# test_hall = example_data_hall[example_data_hall$id == '2133-010', ]
# test_meals = example_meals_hall[example_meals_hall$id == '2133-010', ]
# out = meal_metrics(test_hall, test_meals, interpolate = TRUE, adjust_mealtimes = TRUE)
#
#
# # delta G
# test_that("no changes on Hall 2133-010 for delta G", {
# expect_equal(out$deltag[1], 42.1, tolerance = 0.2)
# expect_equal(out$deltag[2], 25.0, tolerance = 0.2)
# expect_equal(out$deltag[3], 37.2, tolerance = 0.2)
# })
#
# # delta T
# test_that("no changes on Hall 2133-010 for delta T", {
# expect_equal(out$deltat[1], 60, tolerance = 0.2)
# expect_equal(out$deltat[2], 45, tolerance = 0.2)
# expect_equal(out$deltat[3], 155, tolerance = 0.2)
# })
#
# # delta G
# test_that("no changes on Hall 2133-010 for baseline recovery", {
# expect_equal(out$basereco[1], 0.741, tolerance = 0.2)
# expect_equal(out$basereco[2], 1.88, tolerance = 0.2)
# expect_equal(out$basereco[3], 0.918, tolerance = 0.2)
# })
# Test on one subject data
test_hall = example_data_hall[example_data_hall$id == '2133-018', ]
test_meals = example_meals_hall[example_meals_hall$id == '2133-018', ]
out = meal_metrics(test_hall, test_meals, interpolate = TRUE, adjust_mealtimes = TRUE)

# delta G
test_that("no changes on Hall 2133-018 for delta G", {
expect_equal(out$deltag[1], 97.8, tolerance = 0.2)
expect_equal(out$deltag[2], 171, tolerance = 0.2)
expect_equal(out$deltag[3], 77.6, tolerance = 0.2)
})

# delta T
test_that("no changes on Hall 2133-018 for delta T", {
expect_equal(out$deltat[1], 80, tolerance = 0.2)
expect_equal(out$deltat[2], 75, tolerance = 0.2)
expect_equal(out$deltat[3], 75, tolerance = 0.2)
})

# delta G
test_that("no changes on Hall 2133-018 for baseline recovery", {
expect_equal(out$basereco[1], 0.378, tolerance = 0.2)
expect_equal(out$basereco[2], 0.429, tolerance = 0.2)
expect_equal(out$basereco[3], 0.670, tolerance = 0.2)
})

0 comments on commit c36c4bc

Please sign in to comment.