Skip to content

Commit 5cc3218

Browse files
authored
Merge pull request #360 from jamesonquinn/CategoricalInteger1Bug256
Add test case for #256
2 parents 3a547fd + d4bb867 commit 5cc3218

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/modeling_library/distributions.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ end
4848
# out of support
4949
@test logpdf(categorical, -1, [0.2, 0.3, 0.5]) == -Inf
5050

51+
# integer-1 probability bug
52+
N = 20
53+
@test sum([rand(Gen.Distributions.Categorical([1, 0])) for i in 1:N]) == N
54+
5155
# logpdf_grad
5256
f = (x, probs) -> logpdf(categorical, x, probs)
5357
args = (2, [0.2, 0.3, 0.5])

0 commit comments

Comments
 (0)