Skip to content

Commit

Permalink
Skip PCG64 tests on PPC MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
rstub committed May 28, 2024
1 parent ba5be53 commit ac8ebb3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
10 changes: 10 additions & 0 deletions tests/testthat/helper.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
powerpc_apple <- grepl("powerpc-apple-", R.version$platform)

safe_expect_error <- function(..., msg) {
os.type <- Sys.info()["sysname"]
if (os.type == "Darwin") {
expect_error(...)
} else {
expect_error(..., msg)
}
}
9 changes: 0 additions & 9 deletions tests/testthat/test-convert.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
context("conversion")

safe_expect_error <- function(..., msg) {
os.type <- Sys.info()["sysname"]
if (os.type == "Darwin") {
expect_error(...)
} else {
expect_error(..., msg)
}
}

Rcpp::sourceCpp("cpp/convert.cpp") # Warnings about shifts can be ignored.

test_that("conversion to 16-bit integers works correctly", {
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-external-generator.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ test_that("cloned external Xoshiro256++ gives different result only when a diffe
})

test_that("cloned external PCG64 gives different result", {
skip_if(powerpc_apple)
dqrng::dqRNGkind("PCG64")
dqset.seed(use_seed)
expect_true(cloned_calls(stream = 0))
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-generators.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ test_that("Default generator: setting same seed but different stream produces di
})

test_that("PCG64: setting seed produces identical uniformly distributed numbers", {
skip_if(powerpc_apple)
dqRNGkind("pcg64")
dqset.seed(seed)
u1 <- dqrunif(10)
Expand All @@ -49,6 +50,7 @@ test_that("PCG64: setting seed produces identical uniformly distributed numbers"
})

test_that("PCG64: setting seed and stream produces identical uniformly distributed numbers", {
skip_if(powerpc_apple)
dqRNGkind("pcg64")
dqset.seed(seed, 1)
u1 <- dqrunif(10)
Expand All @@ -58,6 +60,7 @@ test_that("PCG64: setting seed and stream produces identical uniformly distribut
})

test_that("PCG64: saving state produces identical uniformly distributed numbers", {
skip_if(powerpc_apple)
dqRNGkind("pcg64")
dqset.seed(seed, 1)
state <- dqrng_get_state()
Expand All @@ -68,6 +71,7 @@ test_that("PCG64: saving state produces identical uniformly distributed numbers"
})

test_that("PCG64: setting same seed but different stream produces different uniformly distributed numbers", {
skip_if(powerpc_apple)
dqRNGkind("pcg64")
dqset.seed(seed, 1)
u1 <- dqrunif(10)
Expand Down

0 comments on commit ac8ebb3

Please sign in to comment.