@@ -8,7 +8,9 @@ using HypothesisTests: HypothesisTests
8
8
export check_MoGtest_default,
9
9
check_MoGtest_default_z_vector, check_dist_numerical, check_gdemo, check_numerical
10
10
11
- function check_dist_numerical (dist, chn; mean_tol= 0.1 , var_atol= 1.0 , var_tol= 0.5 )
11
+ function check_dist_numerical (
12
+ dist, chn; mean_tol= 0.1 , var_atol= 1.0 , var_tol= 0.5 , broken= false , skip= false
13
+ )
12
14
@testset " numerical" begin
13
15
# Extract values.
14
16
chn_xs = Array (chn[1 : 2 : end , namesingroup (chn, :x ), :])
@@ -24,7 +26,7 @@ function check_dist_numerical(dist, chn; mean_tol=0.1, var_atol=1.0, var_tol=0.5
24
26
else
25
27
max (mean_tol, mean_tol * chn_mean)
26
28
end
27
- @test chn_mean ≈ dist_mean atol = atol_m
29
+ @test chn_mean ≈ dist_mean atol = atol_m broken = broken skip = skip
28
30
end
29
31
30
32
# Check variances.
@@ -41,44 +43,52 @@ function check_dist_numerical(dist, chn; mean_tol=0.1, var_atol=1.0, var_tol=0.5
41
43
else
42
44
max (mean_tol, mean_tol * chn_mean)
43
45
end
44
- @test chn_mean ≈ dist_mean atol = atol_v
46
+ @test chn_mean ≈ dist_mean atol = atol_v broken = broken skip = skip
45
47
end
46
48
end
47
49
end
48
50
end
49
51
50
52
# Helper function for numerical tests
51
- function check_numerical (chain, symbols:: Vector , exact_vals:: Vector ; atol= 0.2 , rtol= 0.0 )
53
+ function check_numerical (
54
+ chain, symbols:: Vector , exact_vals:: Vector ; atol= 0.2 , rtol= 0.0 , broken= false , skip= false
55
+ )
52
56
for (sym, val) in zip (symbols, exact_vals)
53
57
E = val isa Real ? mean (chain[sym]) : vec (mean (chain[sym]; dims= 1 ))
54
58
@info (symbol= sym, exact= val, evaluated= E)
55
- @test E ≈ val atol = atol rtol = rtol
59
+ @test E ≈ val atol = atol rtol = rtol broken = broken skip = skip
56
60
end
57
61
end
58
62
59
63
# Wrapper function to quickly check gdemo accuracy.
60
- function check_gdemo (chain; atol= 0.2 , rtol= 0.0 )
61
- return check_numerical (chain, [:s , :m ], [49 / 24 , 7 / 6 ]; atol= atol, rtol= rtol)
64
+ function check_gdemo (chain; atol= 0.2 , rtol= 0.0 , broken= false , skip= false )
65
+ return check_numerical (
66
+ chain, [:s , :m ], [49 / 24 , 7 / 6 ]; atol= atol, rtol= rtol, broken= broken, skip= skip
67
+ )
62
68
end
63
69
64
70
# Wrapper function to check MoGtest.
65
- function check_MoGtest_default (chain; atol= 0.2 , rtol= 0.0 )
71
+ function check_MoGtest_default (chain; atol= 0.2 , rtol= 0.0 , broken = false , skip = false )
66
72
return check_numerical (
67
73
chain,
68
74
[:z1 , :z2 , :z3 , :z4 , :mu1 , :mu2 ],
69
75
[1.0 , 1.0 , 2.0 , 2.0 , 1.0 , 4.0 ];
70
76
atol= atol,
71
77
rtol= rtol,
78
+ broken= broken,
79
+ skip= skip,
72
80
)
73
81
end
74
82
75
- function check_MoGtest_default_z_vector (chain; atol= 0.2 , rtol= 0.0 )
83
+ function check_MoGtest_default_z_vector (chain; atol= 0.2 , rtol= 0.0 , broken = false , skip = false )
76
84
return check_numerical (
77
85
chain,
78
86
[Symbol (" z[1]" ), Symbol (" z[2]" ), Symbol (" z[3]" ), Symbol (" z[4]" ), :mu1 , :mu2 ],
79
87
[1.0 , 1.0 , 2.0 , 2.0 , 1.0 , 4.0 ];
80
88
atol= atol,
81
89
rtol= rtol,
90
+ broken= broken,
91
+ skip= skip,
82
92
)
83
93
end
84
94
0 commit comments