Skip to content

Commit

Permalink
Reset the seed before each test to see if results can be reproduced o…
Browse files Browse the repository at this point in the history
…n CI.
  • Loading branch information
mcol committed Sep 13, 2024
1 parent 14f094c commit fd6c5e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/analyse_SAR.TL.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
{
"type": "double",
"attributes": {},
"value": [415.65648039]
"value": [405.57635798]
},
{
"type": "double",
"attributes": {},
"value": [182.01761352]
"value": [198.54370797]
},
{
"type": "character",
Expand Down
7 changes: 4 additions & 3 deletions tests/testthat/test_analyse_SAR.TL.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
## load data
data(ExampleData.BINfileData, envir = environment())

## set seed as we are using expect_snapshot
set.seed(1)

## transform the values from the first position in a RLum.Analysis object
object <- Risoe.BINfileData2RLum.Analysis(TL.SAR.Data, pos = 3)

Expand All @@ -30,6 +27,7 @@ test_that("Test examples", {

##perform analysis
SW({
set.seed(1) # set seed as we are snapshotting
expect_snapshot_RLum(
analyse_SAR.TL(
object,
Expand All @@ -40,6 +38,7 @@ test_that("Test examples", {
)
)

set.seed(1) # set seed as we are snapshotting
expect_snapshot_RLum(
analyse_SAR.TL(
list(object, object),
Expand All @@ -50,6 +49,7 @@ test_that("Test examples", {
sequence.structure = c("SIGNAL", "BACKGROUND"))
)

set.seed(1) # set seed as we are snapshotting
expect_warning(
expect_snapshot_RLum(
analyse_SAR.TL(
Expand All @@ -63,6 +63,7 @@ test_that("Test examples", {
"log-scale needs positive values; log-scale disabled"
)

set.seed(1) # set seed as we are snapshotting
expect_warning(
expect_snapshot_RLum(
analyse_SAR.TL(object, signal.integral.min = 2, signal.integral.max = 3,
Expand Down

0 comments on commit fd6c5e0

Please sign in to comment.