@@ -23,9 +23,8 @@ Rcpp::sourceCpp("cpp/sugar.cpp")
23
23
24
24
# # There are some (documented, see https://blog.r-project.org/2020/11/02/will-r-work-on-apple-silicon/index.html)
25
25
# # issues with NA propagation on arm64 / macOS. We not (yet ?) do anything special so we just skip some tests
26
- isArmMacOs <- Sys.info()[[" sysname" ]] == " Darwin" && Sys.info()[[" machine" ]] == " arm64"
27
26
# # This also seems to hit arm64 on Linux (aka 'aarch64' here)
28
- isArmLinux <- Sys.info()[[" sysname " ]] == " Linux " && Sys.info()[[" machine" ]] == " aarch64"
27
+ isArm <- Sys.info()[[" machine " ]] == " arm64 " || Sys.info()[[" machine" ]] == " aarch64"
29
28
30
29
# # Needed for a change in R 3.6.0 reducing a bias in very large samples
31
30
suppressWarnings(RNGversion(" 3.5.0" ))
@@ -38,8 +37,8 @@ expect_equal( runit_abs(x,y) , list( abs(x), abs(y) ) )
38
37
# test.sugar.all.one.less <- function( ){
39
38
expect_true( runit_all_one_less( 1 ) )
40
39
expect_true( ! runit_all_one_less( 1 : 10 ) )
41
- if (! isArmMacOs ) expect_true( is.na( runit_all_one_less( NA ) ) )
42
- if (! isArmMacOs ) expect_true( is.na( runit_all_one_less( c( NA , 1 ) ) ) )
40
+ if (! isArm ) expect_true( is.na( runit_all_one_less( NA ) ) )
41
+ if (! isArm ) expect_true( is.na( runit_all_one_less( c( NA , 1 ) ) ) )
43
42
expect_true( ! runit_all_one_less( c( 6 , NA ) ) )
44
43
45
44
@@ -48,14 +47,14 @@ expect_true( ! runit_all_one_greater( 1 ) )
48
47
expect_true( ! runit_all_one_greater( 1 : 10 ) )
49
48
expect_true( runit_all_one_greater( 6 : 10 ) )
50
49
expect_true( ! runit_all_one_greater( c(NA , 1 ) ) )
51
- if (! isArmMacOs ) expect_true( is.na( runit_all_one_greater( c(NA , 6 ) ) ) )
50
+ if (! isArm ) expect_true( is.na( runit_all_one_greater( c(NA , 6 ) ) ) )
52
51
53
52
54
53
# test.sugar.all.one.less.or.equal <- function( ){
55
54
expect_true( runit_all_one_less_or_equal( 1 ) )
56
55
expect_true( ! runit_all_one_less_or_equal( 1 : 10 ) )
57
- if (! isArmMacOs ) expect_true( is.na( runit_all_one_less_or_equal( NA ) ) )
58
- if (! isArmMacOs ) expect_true( is.na( runit_all_one_less_or_equal( c( NA , 1 ) ) ) )
56
+ if (! isArm ) expect_true( is.na( runit_all_one_less_or_equal( NA ) ) )
57
+ if (! isArm ) expect_true( is.na( runit_all_one_less_or_equal( c( NA , 1 ) ) ) )
59
58
expect_true( ! runit_all_one_less_or_equal( c( 6 , NA ) ) )
60
59
expect_true( runit_all_one_less_or_equal( 5 ) )
61
60
@@ -68,15 +67,15 @@ expect_true( ! fx( 1:10 ) )
68
67
expect_true( fx( 6 : 10 ) )
69
68
expect_true( fx( 5 ) )
70
69
expect_true( ! fx( c(NA , 1 ) ) )
71
- if (! isArmMacOs && ! isArmLinux ) expect_true( is.na( fx( c(NA , 6 ) ) ) )
70
+ if (! isArm ) expect_true( is.na( fx( c(NA , 6 ) ) ) )
72
71
73
72
74
73
# test.sugar.all.one.equal <- function( ){
75
74
fx <- runit_all_one_equal
76
75
expect_true( ! fx( 1 ) )
77
76
expect_true( ! fx( 1 : 2 ) )
78
77
expect_true( fx( rep(5 ,4 ) ) )
79
- if (! isArmMacOs && ! isArmLinux ) expect_true( is.na( fx( c(5 ,NA ) ) ) )
78
+ if (! isArm ) expect_true( is.na( fx( c(5 ,NA ) ) ) )
80
79
expect_true(! fx( c(NA , 1 ) ) )
81
80
82
81
@@ -85,7 +84,7 @@ fx <- runit_all_not_equal_one
85
84
expect_true( fx( 1 ) )
86
85
expect_true( fx( 1 : 2 ) )
87
86
expect_true( ! fx( 5 ) )
88
- if (! isArmMacOs && ! isArmLinux ) expect_true( is.na( fx( c(NA , 1 ) ) ) )
87
+ if (! isArm ) expect_true( is.na( fx( c(NA , 1 ) ) ) )
89
88
expect_true( ! fx( c(NA , 5 ) ) )
90
89
91
90
@@ -1622,8 +1621,8 @@ expect_error(strimws(x[1], "invalid"), info = "strimws -- bad `which` argument")
1622
1621
# # min/max
1623
1622
# test.sugar.min.max <- function() {
1624
1623
# # min(empty) gives NA for integer, Inf for numeric (#844)
1625
- if (! isArmMacOs && ! isArmLinux ) expect_true(is.na(intmin(integer(0 ))), " min(integer(0))" )
1626
- if (! isArmMacOs ) expect_equal(doublemin(numeric (0 )), Inf , info = " min(numeric(0))" )
1624
+ if (! isArm ) expect_true(is.na(intmin(integer(0 ))), " min(integer(0))" )
1625
+ if (! isArm ) expect_equal(doublemin(numeric (0 )), Inf , info = " min(numeric(0))" )
1627
1626
1628
1627
# # max(empty_ gives NA for integer, Inf for numeric (#844)
1629
1628
expect_true(is.na(intmax(integer(0 ))), " max(integer(0))" )
0 commit comments