33
44furrr_test_that(" future_map2() matches map2() for simple cases" , {
55 expect_identical(
6- future_map2(1 : 3 , 4 : 6 , ~ .x + .y ),
7- map2(1 : 3 , 4 : 6 , ~ .x + .y )
6+ future_map2(1 : 3 , 4 : 6 , ~ .x + .y ),
7+ map2(1 : 3 , 4 : 6 , ~ .x + .y )
88 )
99})
1010
@@ -27,8 +27,8 @@ furrr_test_that("future_map2_dbl() works", {
2727 y <- c(4 , 5 , 6 )
2828
2929 expect_identical(
30- future_map2_dbl(x , y , ~ .x + .y ),
31- map2_dbl(x , y , ~ .x + .y )
30+ future_map2_dbl(x , y , ~ .x + .y ),
31+ map2_dbl(x , y , ~ .x + .y )
3232 )
3333})
3434
@@ -37,8 +37,8 @@ furrr_test_that("future_map2_int() works", {
3737 y <- c(4L , 5L , 6L )
3838
3939 expect_identical(
40- future_map2_int(x , y , ~ .x + .y ),
41- map2_int(x , y , ~ .x + .y )
40+ future_map2_int(x , y , ~ .x + .y ),
41+ map2_int(x , y , ~ .x + .y )
4242 )
4343})
4444
@@ -47,8 +47,8 @@ furrr_test_that("future_map2_lgl() works", {
4747 y <- c(FALSE , TRUE , TRUE )
4848
4949 expect_identical(
50- future_map2_lgl(x , y , ~ .x || .y ),
51- map2_lgl(x , y , ~ .x || .y )
50+ future_map2_lgl(x , y , ~ .x || .y ),
51+ map2_lgl(x , y , ~ .x || .y )
5252 )
5353})
5454
@@ -86,8 +86,8 @@ furrr_test_that("future_map2_dfr() works", {
8686 y <- c(" d" , " e" , " f" )
8787
8888 expect_identical(
89- future_map2_dfr(x , y , ~ data.frame (x = .x , y = .y )),
90- map2_dfr(x , y , ~ data.frame (x = .x , y = .y ))
89+ future_map2_dfr(x , y , ~ data.frame (x = .x , y = .y )),
90+ map2_dfr(x , y , ~ data.frame (x = .x , y = .y ))
9191 )
9292})
9393
@@ -96,8 +96,8 @@ furrr_test_that("future_map2_dfc() works", {
9696 y <- c(" d" , " e" , " f" )
9797
9898 expect_identical(
99- future_map2_dfc(x , y , ~ as.data.frame(set_names(list (.x ), .y ))),
100- map2_dfc(x , y , ~ as.data.frame(set_names(list (.x ), .y )))
99+ future_map2_dfc(x , y , ~ as.data.frame(set_names(list (.x ), .y ))),
100+ map2_dfc(x , y , ~ as.data.frame(set_names(list (.x ), .y )))
101101 )
102102})
103103
@@ -118,34 +118,34 @@ furrr_test_that("atomic variants work with size zero input", {
118118
119119furrr_test_that(" size one recycling works" , {
120120 expect_identical(
121- future_map2(1 , 1 : 2 , ~ c(.x , .y )),
121+ future_map2(1 , 1 : 2 , ~ c(.x , .y )),
122122 list (c(1 , 1 ), c(1 , 2 ))
123123 )
124124
125125 expect_identical(
126- future_map2(1 : 2 , 1 , ~ c(.x , .y )),
126+ future_map2(1 : 2 , 1 , ~ c(.x , .y )),
127127 list (c(1 , 1 ), c(2 , 1 ))
128128 )
129129
130130 expect_identical(
131- future_map2(integer(), 1 , ~ c(.x , .y )),
131+ future_map2(integer(), 1 , ~ c(.x , .y )),
132132 list ()
133133 )
134134
135135 expect_identical(
136- future_map2(1 , integer(), ~ c(.x , .y )),
136+ future_map2(1 , integer(), ~ c(.x , .y )),
137137 list ()
138138 )
139139})
140140
141141furrr_test_that(" generally can't recycle to size zero" , {
142142 expect_error(
143- future_map2(1 : 2 , integer(), ~ c(.x , .y )),
143+ future_map2(1 : 2 , integer(), ~ c(.x , .y )),
144144 " Can't recycle"
145145 )
146146
147147 expect_error(
148- future_map2(integer(), 1 : 2 , ~ c(.x , .y )),
148+ future_map2(integer(), 1 : 2 , ~ c(.x , .y )),
149149 " Can't recycle"
150150 )
151151})
@@ -159,18 +159,18 @@ furrr_test_that("globals in `.x` and `.y` are found (#16)", {
159159
160160 x <- list (c(1 , 2 , NA ), c(2 , 3 , 4 ))
161161
162- fns1 <- map(x , ~ purrr :: partial(fn1 , x = .x ))
163- fns2 <- map(x , ~ purrr :: partial(fn2 , x = .x ))
162+ fns1 <- map(x , ~ purrr :: partial(fn1 , x = .x ))
163+ fns2 <- map(x , ~ purrr :: partial(fn2 , x = .x ))
164164
165165 expect_identical(
166- future_map2(fns1 , fns2 , ~ c(.x(), .y())),
166+ future_map2(fns1 , fns2 , ~ c(.x(), .y())),
167167 list (c(3 , NA ), c(9 , 9 ))
168168 )
169169})
170170
171171furrr_test_that(" chunk balancing is correct after a recycle (#30)" , {
172172 expect_identical(
173- future_map2(1 , 1 : 4 , ~ c(.x , .y )),
173+ future_map2(1 , 1 : 4 , ~ c(.x , .y )),
174174 list (c(1 , 1 ), c(1 , 2 ), c(1 , 3 ), c(1 , 4 ))
175175 )
176176})
0 commit comments