@@ -19,8 +19,19 @@ norm_val = ones(dim)
19
19
alpha = ones (4 )
20
20
dir_val = fill (0.25 , 4 )
21
21
beta_mat = rand (MatrixBeta (dim, dim, dim))
22
+ tested = []
23
+ function test_info (name)
24
+ if ! (name in tested)
25
+ push! (tested, name)
26
+ @info (" Testing: $(name) " )
27
+ end
28
+ end
29
+ test_head (s) = println (" \n " * s* " \n " )
30
+ separator () = println (" \n " * " =" ^ 50 )
22
31
32
+ separator ()
23
33
@testset " Univariate discrete distributions" begin
34
+ test_head (" Testing: Univariate discrete distributions" )
24
35
uni_disc_dists = [
25
36
DistSpec (:Bernoulli , (0.45 ,), 1 ),
26
37
DistSpec (:Bernoulli , (0.45 ,), 0 ),
@@ -34,13 +45,16 @@ beta_mat = rand(MatrixBeta(dim, dim, dim))
34
45
DistSpec (:PoissonBinomial , ([0.5 , 0.5 ],), 0 ),
35
46
]
36
47
for d in uni_disc_dists
48
+ test_info (d. name)
37
49
for testf in get_all_functions (d, false )
38
50
test_ad (testf. f, testf. x)
39
51
end
40
52
end
41
53
end
54
+ separator ()
42
55
43
56
@testset " Univariate continuous distributions" begin
57
+ test_head (" Testing: Univariate continuous distributions" )
44
58
uni_cont_dists = [
45
59
DistSpec (:Arcsine , (), 0.5 ),
46
60
DistSpec (:Arcsine , (1 ,), 0.5 ),
@@ -145,27 +159,33 @@ end
145
159
DistSpec (:VonMises , (1 , 1 ), 1 ),
146
160
]
147
161
for d in uni_cont_dists
162
+ test_info (d. name)
148
163
for testf in get_all_functions (d, true )
149
164
test_ad (testf. f, testf. x)
150
165
end
151
166
end
152
167
end
168
+ separator ()
153
169
154
170
@testset " Multivariate discrete distributions" begin
171
+ test_head (" Testing: Multivariate discrete distributions" )
155
172
mult_disc_dists = [
156
173
]
157
174
broken_mult_disc_dists = [
158
175
# Dispatch error caused by lack of type parameters in Distributions.Multinomial
159
176
DistSpec (:((p) -> Multinomial (4 , p)), (fill (0.25 , 4 ),), 1 ),
160
177
]
161
178
for d in mult_disc_dists
179
+ test_info (d. name)
162
180
for testf in get_all_functions (d, false )
163
181
test_ad (testf. f, testf. x)
164
182
end
165
183
end
166
184
end
185
+ separator ()
167
186
168
187
@testset " Multivariate continuous distributions" begin
188
+ test_head (" Testing: Multivariate continuous distributions" )
169
189
mult_cont_dists = [
170
190
DistSpec (:MvNormal , (mean, cov_mat), norm_val),
171
191
DistSpec (:MvNormal , (mean, cov_vec), norm_val),
@@ -195,13 +215,16 @@ end
195
215
]
196
216
197
217
for d in mult_cont_dists
218
+ test_info (d. name)
198
219
for testf in get_all_functions (d, true )
199
220
test_ad (testf. f, testf. x)
200
221
end
201
222
end
202
223
end
224
+ separator ()
203
225
204
226
@testset " Matrix-variate continuous distributions" begin
227
+ test_head (" Testing: Matrix-variate continuous distributions" )
205
228
matrix_cont_dists = [
206
229
DistSpec (:((n1, n2)-> MatrixBeta (dim, n1, n2)), (dim, dim), beta_mat),
207
230
]
215
238
]
216
239
217
240
for d in matrix_cont_dists
241
+ test_info (d. name)
218
242
for testf in get_all_functions (d, true )
219
243
test_ad (testf. f, testf. x)
220
244
end
221
245
end
222
246
end
247
+ separator ()
0 commit comments