Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
- {os: macos-latest}
- {os: macos-13}
#- {os: ubuntu-latest}
- {os: ubuntu-24.04-arm}

runs-on: ${{ matrix.os }}

Expand Down
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2025-05-05 Dirk Eddelbuettel <[email protected]>

* inst/tinytest/test_sugar.R: Condition four NA-related tests away on
arm64 on Linux too

* .github/workflows/macos.yaml (jobs): Add ubuntu-24.04-arm to matrix

2025-04-15 Dirk Eddelbuettel <[email protected]>

* docker/ci-4.4/Dockerfile: Added based on r-base:4.4.3
Expand Down
25 changes: 13 additions & 12 deletions inst/tinytest/test_sugar.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

## Copyright (C) 2010 - 2024 Dirk Eddelbuettel and Romain Francois
## Copyright (C) 2010 - 2025 Dirk Eddelbuettel and Romain Francois
## Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar
##
## This file is part of Rcpp.
Expand All @@ -23,7 +23,8 @@ Rcpp::sourceCpp("cpp/sugar.cpp")

## There are some (documented, see https://blog.r-project.org/2020/11/02/will-r-work-on-apple-silicon/index.html)
## issues with NA propagation on arm64 / macOS. We not (yet ?) do anything special so we just skip some tests
isArmMacOs <- Sys.info()[["sysname"]] == "Darwin" && Sys.info()[["machine"]] == "arm64"
## This also seems to hit arm64 on Linux (aka 'aarch64' here)
isArm <- Sys.info()[["machine"]] == "arm64" || Sys.info()[["machine"]] == "aarch64"

## Needed for a change in R 3.6.0 reducing a bias in very large samples
suppressWarnings(RNGversion("3.5.0"))
Expand All @@ -36,8 +37,8 @@ expect_equal( runit_abs(x,y) , list( abs(x), abs(y) ) )
# test.sugar.all.one.less <- function( ){
expect_true( runit_all_one_less( 1 ) )
expect_true( ! runit_all_one_less( 1:10 ) )
if (!isArmMacOs) expect_true( is.na( runit_all_one_less( NA ) ) )
if (!isArmMacOs) expect_true( is.na( runit_all_one_less( c( NA, 1) ) ) )
if (!isArm) expect_true( is.na( runit_all_one_less( NA ) ) )
if (!isArm) expect_true( is.na( runit_all_one_less( c( NA, 1) ) ) )
expect_true( ! runit_all_one_less( c( 6, NA) ) )


Expand All @@ -46,14 +47,14 @@ expect_true( ! runit_all_one_greater( 1 ) )
expect_true( ! runit_all_one_greater( 1:10 ) )
expect_true( runit_all_one_greater( 6:10 ) )
expect_true( ! runit_all_one_greater( c(NA, 1) ) )
if (!isArmMacOs) expect_true( is.na( runit_all_one_greater( c(NA, 6) ) ) )
if (!isArm) expect_true( is.na( runit_all_one_greater( c(NA, 6) ) ) )


# test.sugar.all.one.less.or.equal <- function( ){
expect_true( runit_all_one_less_or_equal( 1 ) )
expect_true( ! runit_all_one_less_or_equal( 1:10 ) )
if (!isArmMacOs) expect_true( is.na( runit_all_one_less_or_equal( NA ) ) )
if (!isArmMacOs) expect_true( is.na( runit_all_one_less_or_equal( c( NA, 1) ) ) )
if (!isArm) expect_true( is.na( runit_all_one_less_or_equal( NA ) ) )
if (!isArm) expect_true( is.na( runit_all_one_less_or_equal( c( NA, 1) ) ) )
expect_true( ! runit_all_one_less_or_equal( c( 6, NA) ) )
expect_true( runit_all_one_less_or_equal( 5 ) )

Expand All @@ -66,15 +67,15 @@ expect_true( ! fx( 1:10 ) )
expect_true( fx( 6:10 ) )
expect_true( fx( 5 ) )
expect_true( ! fx( c(NA, 1) ) )
if (!isArmMacOs) expect_true( is.na( fx( c(NA, 6) ) ) )
if (!isArm) expect_true( is.na( fx( c(NA, 6) ) ) )


# test.sugar.all.one.equal <- function( ){
fx <- runit_all_one_equal
expect_true( ! fx( 1 ) )
expect_true( ! fx( 1:2 ) )
expect_true( fx( rep(5,4) ) )
if (!isArmMacOs) expect_true( is.na( fx( c(5,NA) ) ) )
if (!isArm) expect_true( is.na( fx( c(5,NA) ) ) )
expect_true(! fx( c(NA, 1) ) )


Expand All @@ -83,7 +84,7 @@ fx <- runit_all_not_equal_one
expect_true( fx( 1 ) )
expect_true( fx( 1:2 ) )
expect_true( ! fx( 5 ) )
if (!isArmMacOs) expect_true( is.na( fx( c(NA, 1) ) ) )
if (!isArm) expect_true( is.na( fx( c(NA, 1) ) ) )
expect_true( ! fx( c(NA, 5) ) )


Expand Down Expand Up @@ -1620,8 +1621,8 @@ expect_error(strimws(x[1], "invalid"), info = "strimws -- bad `which` argument")
## min/max
# test.sugar.min.max <- function() {
## min(empty) gives NA for integer, Inf for numeric (#844)
if (!isArmMacOs) expect_true(is.na(intmin(integer(0))), "min(integer(0))")
if (!isArmMacOs) expect_equal(doublemin(numeric(0)), Inf, info = "min(numeric(0))")
if (!isArm) expect_true(is.na(intmin(integer(0))), "min(integer(0))")
if (!isArm) expect_equal(doublemin(numeric(0)), Inf, info = "min(numeric(0))")

## max(empty_ gives NA for integer, Inf for numeric (#844)
expect_true(is.na(intmax(integer(0))), "max(integer(0))")
Expand Down