Skip to content

Commit 0be01a5

Browse files
authored
Add some tests
1 parent 1db8d0e commit 0be01a5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/beta_inc.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,19 @@
210210
@test beta_inc(1.5, 200.5, 0.07,0.93)[1] 0.99999790408564
211211
@test beta_inc(1e-20, 0.000001, 0.2)[2] 1.0000013862929421e-14
212212

213+
# test promotions and return types
214+
for T in (Float64, Float32)
215+
a, b = randexp(T, 2)
216+
x = rand(T)
217+
@test beta_inc(a, b, x) isa Tuple{T,T}
218+
@test beta_inc(a, b, x, 1 - x) isa Tuple{T,T}
219+
@test beta_inc(a, b, x) == beta_inc(a, b, x, 1 - x)
220+
end
221+
a, b = randexp(2)
222+
x = rand()
223+
@test beta_inc(a, Float32(b), x) == beta_inc(a, b, x)
224+
@test beta_inc(a, Float32(b), Float32(x), 1-x) == beta_inc(a, b, x, 1-x)
225+
213226
@test SpecialFunctions.loggammadiv(13.89, 21.0001) log(gamma(big(21.0001))/gamma(big(21.0001)+big(13.89)))
214227
@test SpecialFunctions.stirling_corr(11.99, 100.1) SpecialFunctions.stirling_error(11.99) + SpecialFunctions.stirling_error(100.1) - SpecialFunctions.stirling_error(11.99 + 100.1)
215228
end

0 commit comments

Comments
 (0)