@@ -40,6 +40,23 @@ test_that("epix_slide works as intended",{
4040 )
4141
4242 expect_identical(xx1 ,xx3 ) # This and * Imply xx2 and xx3 are identical
43+
44+ # function interface
45+ xx4 <- xx %> %
46+ group_by(.data $ geo_value ) %> %
47+ epix_slide(f = function (x , g ) {
48+ tibble :: tibble(sum_binary = sum(x $ binary ))
49+ }, before = 2 , names_sep = NULL )
50+
51+ expect_identical(xx1 ,xx4 )
52+
53+ # tidyeval interface
54+ xx5 <- xx %> %
55+ group_by(.data $ geo_value ) %> %
56+ epix_slide(sum_binary = sum(binary ),
57+ before = 2 )
58+
59+ expect_identical(xx1 ,xx5 )
4360})
4461
4562test_that(" epix_slide works as intended with `as_list_col=TRUE`" ,{
@@ -269,6 +286,28 @@ test_that("epix_slide with all_versions option has access to all older versions"
269286
270287 expect_identical(result1 ,result3 ) # This and * Imply result2 and result3 are identical
271288
289+ # formula interface
290+ result4 <- ea %> % group_by() %> %
291+ epix_slide(f = ~ slide_fn(.x , .y ),
292+ before = 10 ^ 3 ,
293+ names_sep = NULL ,
294+ all_versions = TRUE )
295+
296+ expect_identical(result1 ,result4 ) # This and * Imply result2 and result4 are identical
297+
298+ # tidyeval interface
299+ result5 <- ea %> %
300+ group_by() %> %
301+ epix_slide(data = slide_fn(
302+ .data $ clone(), # hack to convert from pronoun back to archive
303+ stop(" slide_fn doesn't use group key, no need to prepare it" )
304+ ),
305+ before = 10 ^ 3 ,
306+ names_sep = NULL ,
307+ all_versions = TRUE )
308+
309+ expect_identical(result1 ,result5 ) # This and * Imply result2 and result5 are identical
310+
272311 expect_identical(ea , ea_orig_mirror ) # We shouldn't have mutated ea
273312})
274313
0 commit comments