@@ -2,38 +2,46 @@ test_that("sparse_is_na() works - double", {
2
2
x <- sparse_double(c(10 , - 10 ), c(5 , 100 ), 1000 )
3
3
4
4
expect_equal(is.na(x ), sparse_is_na(x ))
5
+ expect_equal(as.integer(is.na(x )), sparse_is_na(x , type = " integer" ))
5
6
6
7
x <- sparse_double(c(NA , 10 , 30 ), 1 : 3 , 1000 )
7
8
8
9
expect_equal(is.na(x ), sparse_is_na(x ))
10
+ expect_equal(as.integer(is.na(x )), sparse_is_na(x , type = " integer" ))
9
11
})
10
12
11
13
test_that(" sparse_is_na() works - integer" , {
12
14
x <- sparse_integer(c(10 , - 10 ), c(5 , 100 ), 1000 )
13
15
14
16
expect_equal(is.na(x ), sparse_is_na(x ))
17
+ expect_equal(as.integer(is.na(x )), sparse_is_na(x , type = " integer" ))
15
18
16
19
x <- sparse_integer(c(NA , 10 , 30 ), 1 : 3 , 1000 )
17
20
18
21
expect_equal(is.na(x ), sparse_is_na(x ))
22
+ expect_equal(as.integer(is.na(x )), sparse_is_na(x , type = " integer" ))
19
23
})
20
24
21
25
test_that(" sparse_is_na() works - logical" , {
22
26
x <- sparse_logical(c(TRUE , TRUE ), c(5 , 100 ), 1000 )
23
27
24
28
expect_equal(is.na(x ), sparse_is_na(x ))
29
+ expect_equal(as.integer(is.na(x )), sparse_is_na(x , type = " integer" ))
25
30
26
31
x <- sparse_logical(c(NA , TRUE , TRUE ), 1 : 3 , 1000 )
27
32
28
33
expect_equal(is.na(x ), sparse_is_na(x ))
34
+ expect_equal(as.integer(is.na(x )), sparse_is_na(x , type = " integer" ))
29
35
})
30
36
31
37
test_that(" sparse_is_na() works - character" , {
32
38
x <- sparse_character(c(" A" , " B" ), c(5 , 100 ), 1000 )
33
39
34
40
expect_equal(is.na(x ), sparse_is_na(x ))
41
+ expect_equal(as.integer(is.na(x )), sparse_is_na(x , type = " integer" ))
35
42
36
43
x <- sparse_character(c(NA , " A" , " B" ), 1 : 3 , 1000 )
37
44
38
45
expect_equal(is.na(x ), sparse_is_na(x ))
46
+ expect_equal(as.integer(is.na(x )), sparse_is_na(x , type = " integer" ))
39
47
})
0 commit comments