Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1e10511
Moved to 3e and removed context calls
VisruthSK Mar 24, 2026
5115c34
LLMd testthat 3e syntax changes
VisruthSK Mar 24, 2026
a91cff8
Tweak some minor testing things
VisruthSK Mar 24, 2026
c98740e
Fixed tests
VisruthSK Mar 24, 2026
e1399ba
Refresh test binaries
VisruthSK Mar 24, 2026
ce5f289
Use withr for tests
VisruthSK Mar 24, 2026
2970907
Fix LF issue in tests
VisruthSK Mar 25, 2026
a46a125
Using more withr and testthat 3e features; setting up parallelization…
VisruthSK Mar 25, 2026
e5e7de5
Stabilize parallel test runs
VisruthSK Mar 25, 2026
c66a807
Avoid pak local install in CI
VisruthSK Mar 25, 2026
e2d2e5f
Serialize test model compilation
VisruthSK Mar 25, 2026
8d926bb
Run stateful tests sequentially
VisruthSK Mar 25, 2026
6797833
Stabilize OpenCL test
VisruthSK Mar 25, 2026
86bfac6
Trim unstable OpenCL checks
VisruthSK Mar 25, 2026
29d75db
Run threaded tests sequentially
VisruthSK Mar 25, 2026
1366910
Simplify test harness
VisruthSK Mar 25, 2026
773ca2b
Use repo pak on macOS devel
VisruthSK Mar 25, 2026
159335c
Use devel pak on macOS devel
VisruthSK Mar 25, 2026
dfaee86
Install local package outside pak on macOS devel
VisruthSK Mar 25, 2026
09c3fcd
No parallel tests
VisruthSK Mar 25, 2026
6a01a93
Cleaning tests up; more snapshots
VisruthSK Mar 25, 2026
faf24a8
More snapshots
VisruthSK Mar 25, 2026
08ef444
Small changes
VisruthSK Mar 25, 2026
b7cb687
Bump testthat requirement
VisruthSK Mar 25, 2026
e55042f
Removed brittle snapshots
VisruthSK Mar 25, 2026
d684bc3
Transform windows snapshots to remove .exe
VisruthSK Mar 26, 2026
d0348c6
More snapshots
VisruthSK Mar 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Suggests:
loo (>= 2.0.0),
qs2,
rmarkdown,
testthat (>= 2.1.0),
testthat (>= 3.3.0),
Rcpp
VignetteBuilder: knitr
Config/testthat/edition: 3
8 changes: 8 additions & 0 deletions tests/testthat/_snaps/cpp_opts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# validate_cpp_options works

STAN_OPENCL set to FALSE Since this is a non-empty value, it will result in the corresponding ccp option being turned ON. To turn this option off, use cpp_options = list(stan_opencl = NULL).

# exe_info cpp_options comparison works

Recompiling is recommended due to missing exe_info.

4 changes: 4 additions & 0 deletions tests/testthat/_snaps/data/process-data-float-rounding.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"a": 3,
"b": 2.0
}
7 changes: 7 additions & 0 deletions tests/testthat/_snaps/data/process-data-int-matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"k": [
[18, 18, 16],
[13, 9, 6],
[4, 4, 4]
]
}
4 changes: 4 additions & 0 deletions tests/testthat/_snaps/data/process-data-int-real.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"a": 1,
"b": 2.0
}
4 changes: 4 additions & 0 deletions tests/testthat/_snaps/data/process-data-large-real.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"a": 1,
"b": 1774000000.0
}
47 changes: 47 additions & 0 deletions tests/testthat/_snaps/example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# print_example_program outputs stay stable

Code
cat(print_example_program("schools"))
Output
data {
int<lower=1> J;
vector<lower=0>[J] sigma;
vector[J] y;
}
parameters {
real mu;
real<lower=0> tau;
vector[J] theta;
}
model {
target += normal_lpdf(tau | 0, 10);
target += normal_lpdf(mu | 0, 10);
target += normal_lpdf(theta | mu, tau);
target += normal_lpdf(y | theta, sigma);
}

---

Code
cat(print_example_program("schools_ncp"))
Output
data {
int<lower=1> J;
vector<lower=0>[J] sigma;
vector[J] y;
}
parameters {
real mu;
real<lower=0> tau;
vector[J] theta_raw;
}
transformed parameters {
vector[J] theta = mu + tau * theta_raw;
}
model {
target += normal_lpdf(tau | 0, 10);
target += normal_lpdf(mu | 0, 10);
target += normal_lpdf(theta_raw | 0, 1);
target += normal_lpdf(y | theta, sigma);
}

79 changes: 79 additions & 0 deletions tests/testthat/_snaps/fit-gq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# print() method works after gq

variable mean median sd mad q5 q95
y_rep[1]
y_rep[2]
y_rep[3]
y_rep[4]
y_rep[5]
y_rep[6]
y_rep[7]
y_rep[8]
y_rep[9]
y_rep[10]

# showing 10 of 11 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
variable mean median sd mad q5 q95
y_rep[1]

# showing 1 of 11 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
variable mad
y_rep[1]
y_rep[2]
y_rep[3]
y_rep[4]
y_rep[5]
y_rep[6]
y_rep[7]
y_rep[8]
y_rep[9]
y_rep[10]

# showing 10 of 11 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)

---

variable mean median sd mad q5 q95
y_rep[1]
y_rep[2]

# showing 2 of 11 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
variable mean median sd mad q5 q95
y_rep[1]
y_rep[2]
y_rep[3]
y_rep[4]
y_rep[5]
y_rep[6]
y_rep[7]
y_rep[8]
y_rep[9]
y_rep[10]
sum_y

---

variable mean median sd mad q5 q95
y_rep[1]
y_rep[2]

# showing 2 of 10 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
variable mean median sd mad q5 q95
y_rep[1]
y_rep[2]
y_rep[3]
y_rep[4]
y_rep[5]
y_rep[6]
y_rep[7]
y_rep[8]
y_rep[9]
y_rep[10]

---

variable mean median sd mad q5 q95
y_rep[1]
sum_y
y_rep[3]

17 changes: 17 additions & 0 deletions tests/testthat/_snaps/fit-laplace.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# summary() and print() methods works after laplace

variable mean median sd mad q5 q95
lp__ -65.92 -65.65 1.36 1.20 -68.50 -64.28
lp_approx__ -2.04 -1.75 1.40 1.21 -4.68 -0.35
alpha 0.39 0.38 0.22 0.23 0.03 0.74
beta[1] -0.65 -0.65 0.25 0.26 -1.05 -0.25
beta[2] -0.28 -0.28 0.22 0.23 -0.63 0.09
beta[3] 0.65 0.66 0.26 0.26 0.21 1.07

---

variable mean median sd mad q5 q95
lp__ -65.92 -65.65 1.36 1.20 -68.50 -64.28

# showing 1 of 6 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)

85 changes: 85 additions & 0 deletions tests/testthat/_snaps/fit-mcmc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# print() method works after mcmc

variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
lp__
alpha
beta[1]
beta[2]
beta[3]
variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
lp__

# showing 1 of 5 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
variable ess_sd
lp__
alpha
beta[1]
beta[2]
beta[3]

---

variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
lp__
mu
tau
theta_raw[1]
theta_raw[2]
theta_raw[3]
theta_raw[4]
theta_raw[5]
theta_raw[6]
theta_raw[7]

# showing 10 of 19 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
lp__
mu

# showing 2 of 19 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
lp__
mu
tau
theta_raw[1]
theta_raw[2]
theta_raw[3]
theta_raw[4]
theta_raw[5]
theta_raw[6]
theta_raw[7]
theta_raw[8]
theta[1]
theta[2]
theta[3]
theta[4]
theta[5]
theta[6]
theta[7]
theta[8]

---

variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
theta[1]
theta[2]

# showing 2 of 8 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
theta[1]
theta[2]
theta[3]
theta[4]
theta[5]
theta[6]
theta[7]
theta[8]

---

variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
theta[1]
tau
mu
theta_raw[3]

20 changes: 20 additions & 0 deletions tests/testthat/_snaps/fit-mle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# print() method works after optimization

variable estimate
lp__ -63.92
alpha 0.36
beta[1] -0.63
beta[2] -0.26
beta[3] 0.65

---

variable estimate
lp__ -63.92

# showing 1 of 5 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)

---

Can't find the following variable(s): unknown

71 changes: 71 additions & 0 deletions tests/testthat/_snaps/fit-vb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# print() method works after vb

variable mean median sd mad q5 q95
lp__ -66.75 -66.18 2.16 1.79 -70.59 -64.40
lp_approx__ -2.04 -1.74 1.39 1.26 -4.91 -0.40
alpha 0.30 0.29 0.21 0.20 -0.03 0.64
beta[1] -0.59 -0.58 0.37 0.37 -1.18 0.02
beta[2] -0.25 -0.25 0.22 0.23 -0.64 0.09
beta[3] 0.60 0.61 0.27 0.28 0.13 1.02
variable mean median sd mad q5 q95
lp__ -66.75 -66.18 2.16 1.79 -70.59 -64.40

# showing 1 of 6 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)

---

variable mean median sd mad q5 q95
lp__ -47.27 -46.75 2.69 2.15 -51.93 -43.98
lp_approx__ -5.05 -4.68 2.27 2.08 -9.18 -1.98
mu 6.55 6.52 3.82 3.78 0.24 12.67
tau 3.87 3.05 2.81 2.00 1.01 9.44
theta_raw[1] 0.44 0.44 0.98 0.97 -1.15 1.97
theta_raw[2] 0.14 0.12 0.92 0.89 -1.39 1.63
theta_raw[3] -0.21 -0.18 1.00 1.01 -1.86 1.38
theta_raw[4] 0.11 0.12 0.88 0.88 -1.35 1.55
theta_raw[5] -0.11 -0.12 1.00 1.03 -1.66 1.57
theta_raw[6] 0.04 0.03 0.78 0.81 -1.26 1.31

# showing 10 of 20 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
variable mean median sd mad q5 q95
lp__ -47.27 -46.75 2.69 2.15 -51.93 -43.98
lp_approx__ -5.05 -4.68 2.27 2.08 -9.18 -1.98
mu 6.55 6.52 3.82 3.78 0.24 12.67
tau 3.87 3.05 2.81 2.00 1.01 9.44
theta_raw[1] 0.44 0.44 0.98 0.97 -1.15 1.97
theta_raw[2] 0.14 0.12 0.92 0.89 -1.39 1.63
theta_raw[3] -0.21 -0.18 1.00 1.01 -1.86 1.38
theta_raw[4] 0.11 0.12 0.88 0.88 -1.35 1.55
theta_raw[5] -0.11 -0.12 1.00 1.03 -1.66 1.57
theta_raw[6] 0.04 0.03 0.78 0.81 -1.26 1.31
theta_raw[7] 0.34 0.33 0.98 0.99 -1.24 1.96
theta_raw[8] 0.10 0.10 0.97 0.97 -1.47 1.68
theta[1] 8.21 7.82 6.46 5.22 -1.00 17.39
theta[2] 7.23 7.00 6.04 4.97 -2.01 16.92
theta[3] 5.75 5.92 6.03 5.26 -3.41 14.73
theta[4] 6.90 6.98 5.90 5.03 -2.08 16.23
theta[5] 6.03 5.78 6.50 5.13 -3.18 16.17
theta[6] 6.74 6.84 5.36 4.86 -1.99 15.91
theta[7] 7.80 7.57 6.21 5.41 -1.44 18.38
theta[8] 7.07 6.85 5.94 5.30 -2.19 17.13

---

variable mean median sd mad q5 q95
theta[1] 8.21 7.82 6.46 5.22 -1.00 17.39
theta[2] 7.23 7.00 6.04 4.97 -2.01 16.92
theta[3] 5.75 5.92 6.03 5.26 -3.41 14.73
theta[4] 6.90 6.98 5.90 5.03 -2.08 16.23
theta[5] 6.03 5.78 6.50 5.13 -3.18 16.17
theta[6] 6.74 6.84 5.36 4.86 -1.99 15.91
theta[7] 7.80 7.57 6.21 5.41 -1.44 18.38
theta[8] 7.07 6.85 5.94 5.30 -2.19 17.13
tau 3.87 3.05 2.81 2.00 1.01 9.44
lp__ -47.27 -46.75 2.69 2.15 -51.93 -43.98

# showing 10 of 11 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)

---

Can't find the following variable(s): unknown

Loading
Loading