11
2- # # Copyright (C) 2010 - 2019 Dirk Eddelbuettel and Romain Francois
2+ # # Copyright (C) 2010 - 2023 Dirk Eddelbuettel and Romain Francois
33# #
44# # This file is part of Rcpp.
55# #
@@ -20,6 +20,10 @@ if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to
2020
2121Rcpp :: sourceCpp(" cpp/sugar.cpp" )
2222
23+ # # There are some (documented, see https://blog.r-project.org/2020/11/02/will-r-work-on-apple-silicon/index.html)
24+ # # issues with NA propagation on arm64 / macOS. We not (yet ?) do anything special so we just skip some tests
25+ isArmMacOs <- Sys.info()[[" sysname" ]] == " Darwin" && Sys.info()[[" machine" ]] == " arm64"
26+
2327# # Needed for a change in R 3.6.0 reducing a bias in very large samples
2428suppressWarnings(RNGversion(" 3.5.0" ))
2529
@@ -31,8 +35,8 @@ expect_equal( runit_abs(x,y) , list( abs(x), abs(y) ) )
3135# test.sugar.all.one.less <- function( ){
3236expect_true( runit_all_one_less( 1 ) )
3337expect_true( ! runit_all_one_less( 1 : 10 ) )
34- expect_true( is.na( runit_all_one_less( NA ) ) )
35- expect_true( is.na( runit_all_one_less( c( NA , 1 ) ) ) )
38+ if ( ! isArmMacOs ) expect_true( is.na( runit_all_one_less( NA ) ) )
39+ if ( ! isArmMacOs ) expect_true( is.na( runit_all_one_less( c( NA , 1 ) ) ) )
3640expect_true( ! runit_all_one_less( c( 6 , NA ) ) )
3741
3842
@@ -41,14 +45,14 @@ expect_true( ! runit_all_one_greater( 1 ) )
4145expect_true( ! runit_all_one_greater( 1 : 10 ) )
4246expect_true( runit_all_one_greater( 6 : 10 ) )
4347expect_true( ! runit_all_one_greater( c(NA , 1 ) ) )
44- expect_true( is.na( runit_all_one_greater( c(NA , 6 ) ) ) )
48+ if ( ! isArmMacOs ) expect_true( is.na( runit_all_one_greater( c(NA , 6 ) ) ) )
4549
4650
4751# test.sugar.all.one.less.or.equal <- function( ){
4852expect_true( runit_all_one_less_or_equal( 1 ) )
4953expect_true( ! runit_all_one_less_or_equal( 1 : 10 ) )
50- expect_true( is.na( runit_all_one_less_or_equal( NA ) ) )
51- expect_true( is.na( runit_all_one_less_or_equal( c( NA , 1 ) ) ) )
54+ if ( ! isArmMacOs ) expect_true( is.na( runit_all_one_less_or_equal( NA ) ) )
55+ if ( ! isArmMacOs ) expect_true( is.na( runit_all_one_less_or_equal( c( NA , 1 ) ) ) )
5256expect_true( ! runit_all_one_less_or_equal( c( 6 , NA ) ) )
5357expect_true( runit_all_one_less_or_equal( 5 ) )
5458
@@ -61,15 +65,15 @@ expect_true( ! fx( 1:10 ) )
6165expect_true( fx( 6 : 10 ) )
6266expect_true( fx( 5 ) )
6367expect_true( ! fx( c(NA , 1 ) ) )
64- expect_true( is.na( fx( c(NA , 6 ) ) ) )
68+ if ( ! isArmMacOs ) expect_true( is.na( fx( c(NA , 6 ) ) ) )
6569
6670
6771# test.sugar.all.one.equal <- function( ){
6872fx <- runit_all_one_equal
6973expect_true( ! fx( 1 ) )
7074expect_true( ! fx( 1 : 2 ) )
7175expect_true( fx( rep(5 ,4 ) ) )
72- expect_true( is.na( fx( c(5 ,NA ) ) ) )
76+ if ( ! isArmMacOs ) expect_true( is.na( fx( c(5 ,NA ) ) ) )
7377expect_true(! fx( c(NA , 1 ) ) )
7478
7579
@@ -78,7 +82,7 @@ fx <- runit_all_not_equal_one
7882expect_true( fx( 1 ) )
7983expect_true( fx( 1 : 2 ) )
8084expect_true( ! fx( 5 ) )
81- expect_true( is.na( fx( c(NA , 1 ) ) ) )
85+ if ( ! isArmMacOs ) expect_true( is.na( fx( c(NA , 1 ) ) ) )
8286expect_true( ! fx( c(NA , 5 ) ) )
8387
8488
@@ -1564,7 +1568,7 @@ expect_error(strimws(x[1], "invalid"), info = "strimws -- bad `which` argument")
15641568# test.sugar.min.max <- function() {
15651569# # min(empty) gives NA for integer, Inf for numeric (#844)
15661570expect_true(is.na(intmin(integer(0 ))), " min(integer(0))" )
1567- expect_equal(doublemin(numeric (0 )), Inf , info = " min(numeric(0))" )
1571+ if ( ! isArmMacOs ) expect_equal(doublemin(numeric (0 )), Inf , info = " min(numeric(0))" )
15681572
15691573# # max(empty_ gives NA for integer, Inf for numeric (#844)
15701574expect_true(is.na(intmax(integer(0 ))), " max(integer(0))" )
0 commit comments