Add seeds to tests so that R check never fail master
authorBenjamin Auder <benjamin.auder@somewhere>
Tue, 14 Apr 2026 09:00:13 +0000 (11:00 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Tue, 14 Apr 2026 09:00:13 +0000 (11:00 +0200)
pkg/tests/testthat/test-alignMatrices.R
pkg/tests/testthat/test-computeMu.R
pkg/tests/testthat/test-hungarianAlgorithm.R
pkg/tests/testthat/test-jointDiag.R

index 63e4bd3..ca18e0c 100644 (file)
@@ -13,6 +13,7 @@
 
 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)
@@ -41,6 +42,7 @@ test_that("labelSwitchingAlign correctly aligns de-noised 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)
index c1fd4f9..44ad9eb 100644 (file)
@@ -1,5 +1,6 @@
 test_that("on input of sufficient size, β/||β|| is estimated accurately enough",
 {
+  set.seed(42)
   n <- 100000
   d <- 2
   K <- 2
index 4eacbb9..db41935 100644 (file)
@@ -1,5 +1,6 @@
 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)
index 3fb057c..cf87b17 100644 (file)
@@ -1,6 +1,7 @@
 #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)
@@ -30,6 +31,7 @@
 
 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) )