1
1
2
- # # Copyright (C) 2010 - 2019 Dirk Eddelbuettel and Romain Francois
2
+ # # Copyright (C) 2010 - 2023 Dirk Eddelbuettel and Romain Francois
3
3
# #
4
4
# # This file is part of Rcpp.
5
5
# #
@@ -20,6 +20,10 @@ if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to
20
20
21
21
Rcpp :: sourceCpp(" cpp/sugar.cpp" )
22
22
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
+
23
27
# # Needed for a change in R 3.6.0 reducing a bias in very large samples
24
28
suppressWarnings(RNGversion(" 3.5.0" ))
25
29
@@ -31,8 +35,8 @@ expect_equal( runit_abs(x,y) , list( abs(x), abs(y) ) )
31
35
# test.sugar.all.one.less <- function( ){
32
36
expect_true( runit_all_one_less( 1 ) )
33
37
expect_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 ) ) ) )
36
40
expect_true( ! runit_all_one_less( c( 6 , NA ) ) )
37
41
38
42
@@ -41,14 +45,14 @@ expect_true( ! runit_all_one_greater( 1 ) )
41
45
expect_true( ! runit_all_one_greater( 1 : 10 ) )
42
46
expect_true( runit_all_one_greater( 6 : 10 ) )
43
47
expect_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 ) ) ) )
45
49
46
50
47
51
# test.sugar.all.one.less.or.equal <- function( ){
48
52
expect_true( runit_all_one_less_or_equal( 1 ) )
49
53
expect_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 ) ) ) )
52
56
expect_true( ! runit_all_one_less_or_equal( c( 6 , NA ) ) )
53
57
expect_true( runit_all_one_less_or_equal( 5 ) )
54
58
@@ -61,15 +65,15 @@ expect_true( ! fx( 1:10 ) )
61
65
expect_true( fx( 6 : 10 ) )
62
66
expect_true( fx( 5 ) )
63
67
expect_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 ) ) ) )
65
69
66
70
67
71
# test.sugar.all.one.equal <- function( ){
68
72
fx <- runit_all_one_equal
69
73
expect_true( ! fx( 1 ) )
70
74
expect_true( ! fx( 1 : 2 ) )
71
75
expect_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 ) ) ) )
73
77
expect_true(! fx( c(NA , 1 ) ) )
74
78
75
79
@@ -78,7 +82,7 @@ fx <- runit_all_not_equal_one
78
82
expect_true( fx( 1 ) )
79
83
expect_true( fx( 1 : 2 ) )
80
84
expect_true( ! fx( 5 ) )
81
- expect_true( is.na( fx( c(NA , 1 ) ) ) )
85
+ if ( ! isArmMacOs ) expect_true( is.na( fx( c(NA , 1 ) ) ) )
82
86
expect_true( ! fx( c(NA , 5 ) ) )
83
87
84
88
@@ -1564,7 +1568,7 @@ expect_error(strimws(x[1], "invalid"), info = "strimws -- bad `which` argument")
1564
1568
# test.sugar.min.max <- function() {
1565
1569
# # min(empty) gives NA for integer, Inf for numeric (#844)
1566
1570
expect_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))" )
1568
1572
1569
1573
# # max(empty_ gives NA for integer, Inf for numeric (#844)
1570
1574
expect_true(is.na(intmax(integer(0 ))), " max(integer(0))" )
0 commit comments