@@ -1386,3 +1386,29 @@ test_that("`epi_slide_mean` errors when passed `col_names` as list", {
1386
1386
class = " epiprocess__epi_slide_mean__col_names_in_list"
1387
1387
)
1388
1388
})
1389
+
1390
+ test_that(" epi_slide_mean produces same output as epi_slide_opt" , {
1391
+ result1 <- epi_slide_mean(small_x , value , before = 50 , names_sep = NULL , na.rm = TRUE )
1392
+ result2 <- epi_slide_opt(small_x , value , f = data.table :: frollmean ,
1393
+ before = 50 , names_sep = NULL , na.rm = TRUE )
1394
+ expect_identical(result1 , result2 )
1395
+
1396
+ # # Theoretically should work, but getting "Error: C stack usage 7973092 is
1397
+ # too close to the limit" (recursion is too deep)
1398
+ # result3 <- epi_slide_opt(small_x, value, f = slider::slide_mean,
1399
+ # before = 50, names_sep = NULL, na_rm = TRUE)
1400
+ # expect_equal(result1, result3)
1401
+ })
1402
+
1403
+ test_that(" epi_slide_sum produces same output as epi_slide_opt" , {
1404
+ result1 <- epi_slide_sum(small_x , value , before = 50 , names_sep = NULL , na.rm = TRUE )
1405
+ result2 <- epi_slide_opt(small_x , value , f = data.table :: frollsum ,
1406
+ before = 50 , names_sep = NULL , na.rm = TRUE )
1407
+ expect_identical(result1 , result2 )
1408
+
1409
+ # # Theoretically should work, but getting "Error: C stack usage 7973092 is
1410
+ # too close to the limit" (recursion is too deep)
1411
+ # result3 <- epi_slide_opt(small_x, value, f = slider::slide_sum,
1412
+ # before = 50, names_sep = NULL, na_rm = TRUE)
1413
+ # expect_equal(result1, result3)
1414
+ })
0 commit comments