Skip to content

Commit 369fc73

Browse files
committed
Fixing unit tests for CRAN
1 parent 7eeea65 commit 369fc73

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Type: Package
22
Package: simstudy
33
Title: Simulation of Study Data
4-
Version: 0.9.1.9000
5-
Date: 2025-12-10
4+
Version: 0.9.2
5+
Date: 2026-02-06
66
Authors@R:
77
c(person(given = "Keith",
88
family = "Goldfeld",

NEWS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# simstudy (development version)
1+
# simstudy (0.9.2)
2+
3+
* A minor fix in a unit test for correlated matrices that was failing on CRAN due to
4+
tolerance error.
25

36
# simstudy 0.9.1
47

tests/testthat/test-generate_correlated_data.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ test_that("Basic Functionality Test", {
593593
})
594594

595595
test_that("Distribution Test", {
596+
set.seed(1000)
596597
def <- defData(varname = "xNorm", formula = 8, variance = 4, dist = "normal")
597598
def <- defData(def, varname = "xGamma1", formula = 15, variance = 2, dist = "gamma")
598599
def <- defData(def, varname = "xUniform1", formula = "3;8", dist = "uniform")
@@ -612,17 +613,19 @@ test_that("Distribution Test", {
612613
})
613614

614615
test_that("Correlation Structure Test", {
616+
set.seed(123)
615617
def <- defData(varname = "xNorm", formula = 7, variance = 4, dist = "normal")
616618
def <- defData(def, varname = "xGamma1", formula = 15, variance = 2, dist = "gamma")
617619

618-
dt <- genCorFlex(500, def, rho = .3, corstr = "cs")
620+
dt <- genCorFlex(1000, def, rho = .3, corstr = "cs")
619621

620622
cor_matrix <- cor(dt[, -"id"])
621623
expect_equal(cor_matrix, matrix(c(1, .3, .3, 1), 2, 2),
622624
tolerance = .15, check.attributes = FALSE)
623625
})
624626

625627
test_that("Correlation Structure Test for tau", {
628+
set.seed(123)
626629
def <- defData(varname = "xPois1", formula = 7, dist = "poisson")
627630
def <- defData(def, varname = "xPois2", formula = 15, dist = "poisson")
628631

@@ -633,6 +636,7 @@ test_that("Correlation Structure Test for tau", {
633636
})
634637

635638
test_that("Character error for formula", {
639+
set.seed(123)
636640
# Create a definition with a non-numeric formula to trigger the warning
637641
def <- data.table::data.table(
638642
varname = c("xNorm", "xInvalid"),

0 commit comments

Comments
 (0)