1
1
2
- # # Copyright (C) 2010 - 2024 Dirk Eddelbuettel and Romain Francois
2
+ # # Copyright (C) 2010 - 2025 Dirk Eddelbuettel and Romain Francois
3
3
# # Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar
4
4
# #
5
5
# # This file is part of Rcpp.
@@ -23,7 +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"
26
+ # # This also seems to hit arm64 on Linux (aka 'aarch64' here)
27
+ isArm <- Sys.info()[[" machine" ]] == " arm64" || Sys.info()[[" machine" ]] == " aarch64"
27
28
28
29
# # Needed for a change in R 3.6.0 reducing a bias in very large samples
29
30
suppressWarnings(RNGversion(" 3.5.0" ))
@@ -36,8 +37,8 @@ expect_equal( runit_abs(x,y) , list( abs(x), abs(y) ) )
36
37
# test.sugar.all.one.less <- function( ){
37
38
expect_true( runit_all_one_less( 1 ) )
38
39
expect_true( ! runit_all_one_less( 1 : 10 ) )
39
- if (! isArmMacOs ) expect_true( is.na( runit_all_one_less( NA ) ) )
40
- 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 ) ) ) )
41
42
expect_true( ! runit_all_one_less( c( 6 , NA ) ) )
42
43
43
44
@@ -46,14 +47,14 @@ expect_true( ! runit_all_one_greater( 1 ) )
46
47
expect_true( ! runit_all_one_greater( 1 : 10 ) )
47
48
expect_true( runit_all_one_greater( 6 : 10 ) )
48
49
expect_true( ! runit_all_one_greater( c(NA , 1 ) ) )
49
- 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 ) ) ) )
50
51
51
52
52
53
# test.sugar.all.one.less.or.equal <- function( ){
53
54
expect_true( runit_all_one_less_or_equal( 1 ) )
54
55
expect_true( ! runit_all_one_less_or_equal( 1 : 10 ) )
55
- if (! isArmMacOs ) expect_true( is.na( runit_all_one_less_or_equal( NA ) ) )
56
- 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 ) ) ) )
57
58
expect_true( ! runit_all_one_less_or_equal( c( 6 , NA ) ) )
58
59
expect_true( runit_all_one_less_or_equal( 5 ) )
59
60
@@ -66,15 +67,15 @@ expect_true( ! fx( 1:10 ) )
66
67
expect_true( fx( 6 : 10 ) )
67
68
expect_true( fx( 5 ) )
68
69
expect_true( ! fx( c(NA , 1 ) ) )
69
- if (! isArmMacOs ) expect_true( is.na( fx( c(NA , 6 ) ) ) )
70
+ if (! isArm ) expect_true( is.na( fx( c(NA , 6 ) ) ) )
70
71
71
72
72
73
# test.sugar.all.one.equal <- function( ){
73
74
fx <- runit_all_one_equal
74
75
expect_true( ! fx( 1 ) )
75
76
expect_true( ! fx( 1 : 2 ) )
76
77
expect_true( fx( rep(5 ,4 ) ) )
77
- if (! isArmMacOs ) expect_true( is.na( fx( c(5 ,NA ) ) ) )
78
+ if (! isArm ) expect_true( is.na( fx( c(5 ,NA ) ) ) )
78
79
expect_true(! fx( c(NA , 1 ) ) )
79
80
80
81
@@ -83,7 +84,7 @@ fx <- runit_all_not_equal_one
83
84
expect_true( fx( 1 ) )
84
85
expect_true( fx( 1 : 2 ) )
85
86
expect_true( ! fx( 5 ) )
86
- if (! isArmMacOs ) expect_true( is.na( fx( c(NA , 1 ) ) ) )
87
+ if (! isArm ) expect_true( is.na( fx( c(NA , 1 ) ) ) )
87
88
expect_true( ! fx( c(NA , 5 ) ) )
88
89
89
90
@@ -1620,8 +1621,8 @@ expect_error(strimws(x[1], "invalid"), info = "strimws -- bad `which` argument")
1620
1621
# # min/max
1621
1622
# test.sugar.min.max <- function() {
1622
1623
# # min(empty) gives NA for integer, Inf for numeric (#844)
1623
- if (! isArmMacOs ) expect_true(is.na(intmin(integer(0 ))), " min(integer(0))" )
1624
- 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))" )
1625
1626
1626
1627
# # max(empty_ gives NA for integer, Inf for numeric (#844)
1627
1628
expect_true(is.na(intmax(integer(0 ))), " max(integer(0))" )
0 commit comments