Skip to content

Commit 7df2a1f

Browse files
committed
changed tests to reflect that duration between two thresholds now excludes the upper threshold
1 parent ca15723 commit 7df2a1f

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

tests/testthat/test-metric_duration_above_threshold.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test_that("Calculation works", {
1212
duration_above_threshold(MEDI, datetime, "below", 100), lubridate::dminutes(7)
1313
)
1414
expect_equal(
15-
duration_above_threshold(MEDI, datetime, threshold = c(0,99)), lubridate::dminutes(5)
15+
duration_above_threshold(MEDI, datetime, threshold = c(0,99)), lubridate::dminutes(4)
1616
)
1717
})
1818

tests/testthat/test-metric_period_above_threshold.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test_that("Calculation works", {
99
period_above_threshold(MEDI, datetime, "below", 10), lubridate::dminutes(5)
1010
)
1111
expect_equal(
12-
period_above_threshold(MEDI, datetime, threshold = c(12,13)), lubridate::dminutes(2)
12+
period_above_threshold(MEDI, datetime, threshold = c(12,13)), lubridate::dminutes(1)
1313
)
1414
expect_equal(
1515
period_above_threshold(MEDI, datetime, threshold = 10, loop = TRUE), lubridate::dminutes(7)

tests/testthat/test-metric_pulses_above_threshold.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ test_that("calculation works", {
5353
pulses_above_threshold(MEDI,Time,"above",c(10,30),"1 mins", "1 mins", 0, as.df = TRUE),
5454
tibble::tibble(
5555
"n_pulses_within_10-30" = 1,
56-
"mean_level_pulses_within_10-30" = 20,
57-
"mean_duration_pulses_within_10-30" = lubridate::dminutes(3),
58-
"total_duration_pulses_within_10-30" = lubridate::dminutes(3),
56+
"mean_level_pulses_within_10-30" = 15,
57+
"mean_duration_pulses_within_10-30" = lubridate::dminutes(2),
58+
"total_duration_pulses_within_10-30" = lubridate::dminutes(2),
5959
"mean_onset_pulses_within_10-30" = lubridate::dminutes(1),
60-
"mean_midpoint_pulses_within_10-30" = lubridate::dminutes(2),
61-
"mean_offset_pulses_within_10-30" = lubridate::dminutes(3),
60+
"mean_midpoint_pulses_within_10-30" = lubridate::dminutes(1.5),
61+
"mean_offset_pulses_within_10-30" = lubridate::dminutes(2),
6262
)
6363
)
6464
})

tests/testthat/test-metric_timing_above_threshold.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ test_that("Calculation works", {
2020
expect_equal(
2121
timing_above_threshold(MEDI, Datetime, threshold = c(250, 500)),
2222
list(
23-
"mean" = lubridate::as_datetime(lubridate::dhours(10), tz = "UTC"),
23+
"mean" = lubridate::as_datetime(lubridate::dhours(7.5), tz = "UTC"),
2424
"first" = lubridate::as_datetime(lubridate::dhours(6), tz = "UTC"),
25-
"last" = lubridate::as_datetime(lubridate::dhours(14), tz = "UTC")
25+
"last" = lubridate::as_datetime(lubridate::dhours(9), tz = "UTC")
2626
)
2727
)
2828
})

0 commit comments

Comments
 (0)