Skip to content

Commit b6cc8f0

Browse files
committed
distr_wrappers: add tests for multivariate distrs
1 parent 483f500 commit b6cc8f0

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

test/distribution_wrappers.jl

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
11
@testset "distribution_wrappers.jl" begin
2-
d = Normal()
3-
nd = DynamicPPL.NoDist(d)
2+
@testset "univariate" begin
3+
d = Normal()
4+
nd = DynamicPPL.NoDist(d)
45

5-
# Smoke test
6-
rand(nd)
6+
# Smoke test
7+
rand(nd)
78

8-
# Actual tests
9-
@test minimum(nd) == -Inf
10-
@test maximum(nd) == Inf
11-
@test logpdf(nd, 15.0) == 0
12-
@test Bijectors.logpdf_with_trans(nd, 0) == 0
9+
# Actual tests
10+
@test minimum(nd) == -Inf
11+
@test maximum(nd) == Inf
12+
@test logpdf(nd, 15.0) == 0
13+
@test Bijectors.logpdf_with_trans(nd, 0) == 0
14+
@test Bijectors.bijector(nd) == Bijectors.bijector(d)
15+
end
16+
17+
@testset "multivariate" begin
18+
d = Product([Normal(), Uniform()])
19+
nd = DynamicPPL.NoDist(d)
20+
21+
# Smoke test
22+
@test length(rand(nd)) == 2
23+
24+
# Actual tests
25+
#@test length(nd) == 2
26+
#@test size(nd) == (2,)
27+
@test minimum(nd) == [-Inf, 0.0]
28+
@test maximum(nd) == [Inf, 1.0]
29+
@test logpdf(nd, [15.0, 0.5]) == 0
30+
@test Bijectors.logpdf_with_trans(nd, [0, 1]) == 0
31+
@test Bijectors.bijector(nd) == Bijectors.bijector(d)
32+
end
1333
end

0 commit comments

Comments
 (0)