projects
/
morpheus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a0b1459
)
Add seeds to tests so that R check never fail
master
author
Benjamin Auder
<benjamin.auder@somewhere>
Tue, 14 Apr 2026 09:00:13 +0000
(11:00 +0200)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Tue, 14 Apr 2026 09:00:13 +0000
(11:00 +0200)
pkg/tests/testthat/test-alignMatrices.R
patch
|
blob
|
blame
|
history
pkg/tests/testthat/test-computeMu.R
patch
|
blob
|
blame
|
history
pkg/tests/testthat/test-hungarianAlgorithm.R
patch
|
blob
|
blame
|
history
pkg/tests/testthat/test-jointDiag.R
patch
|
blob
|
blame
|
history
diff --git
a/pkg/tests/testthat/test-alignMatrices.R
b/pkg/tests/testthat/test-alignMatrices.R
index
63e4bd3
..
ca18e0c
100644
(file)
--- a/
pkg/tests/testthat/test-alignMatrices.R
+++ b/
pkg/tests/testthat/test-alignMatrices.R
@@
-13,6
+13,7
@@
test_that("labelSwitchingAlign correctly aligns de-noised parameters",
{
test_that("labelSwitchingAlign correctly aligns de-noised parameters",
{
+ set.seed(32)
N <- 30 #number of matrices
d_K_list <- list(c(2,2), c(5,3))
for (i in 1:2)
N <- 30 #number of matrices
d_K_list <- list(c(2,2), c(5,3))
for (i in 1:2)
@@
-41,6
+42,7
@@
test_that("labelSwitchingAlign correctly aligns de-noised parameters",
test_that("labelSwitchingAlign correctly aligns noisy parameters",
{
test_that("labelSwitchingAlign correctly aligns noisy parameters",
{
+ set.seed(32)
N <- 30 #number of matrices
d_K_list <- list(c(2,2), c(5,3))
for (i in 1:2)
N <- 30 #number of matrices
d_K_list <- list(c(2,2), c(5,3))
for (i in 1:2)
diff --git
a/pkg/tests/testthat/test-computeMu.R
b/pkg/tests/testthat/test-computeMu.R
index
c1fd4f9
..
44ad9eb
100644
(file)
--- a/
pkg/tests/testthat/test-computeMu.R
+++ b/
pkg/tests/testthat/test-computeMu.R
@@
-1,5
+1,6
@@
test_that("on input of sufficient size, β/||β|| is estimated accurately enough",
{
test_that("on input of sufficient size, β/||β|| is estimated accurately enough",
{
+ set.seed(42)
n <- 100000
d <- 2
K <- 2
n <- 100000
d <- 2
K <- 2
diff --git
a/pkg/tests/testthat/test-hungarianAlgorithm.R
b/pkg/tests/testthat/test-hungarianAlgorithm.R
index
4eacbb9
..
db41935
100644
(file)
--- a/
pkg/tests/testthat/test-hungarianAlgorithm.R
+++ b/
pkg/tests/testthat/test-hungarianAlgorithm.R
@@
-1,5
+1,6
@@
test_that("HungarianAlgorithm provides the correct answer on various inputs",
{
test_that("HungarianAlgorithm provides the correct answer on various inputs",
{
+ set.seed(42)
for (n in c(2,3,10,50))
{
for (repetition in 1:3)
for (n in c(2,3,10,50))
{
for (repetition in 1:3)
diff --git
a/pkg/tests/testthat/test-jointDiag.R
b/pkg/tests/testthat/test-jointDiag.R
index
3fb057c
..
cf87b17
100644
(file)
--- a/
pkg/tests/testthat/test-jointDiag.R
+++ b/
pkg/tests/testthat/test-jointDiag.R
@@
-1,6
+1,7
@@
#auxiliary to test diagonality
.computeMuCheckDiag = function(X, Y, K, jd_method, β_ref)
{
#auxiliary to test diagonality
.computeMuCheckDiag = function(X, Y, K, jd_method, β_ref)
{
+ set.seed(99)
d <- ncol(X)
#TODO: redundant code, same as computeMu() main method. Comments are stripped
M3 <- .Moments_M3(X,Y)
d <- ncol(X)
#TODO: redundant code, same as computeMu() main method. Comments are stripped
M3 <- .Moments_M3(X,Y)
@@
-30,6
+31,7
@@
test_that("'jedi' and 'uwedge' joint-diagonalization methods return a correct matrix",
{
test_that("'jedi' and 'uwedge' joint-diagonalization methods return a correct matrix",
{
+ set.seed(99)
n <- 10000
d_K <- list( c(2,2), c(5,3), c(20,13) )
n <- 10000
d_K <- list( c(2,2), c(5,3), c(20,13) )