Skip to content

Commit 620ef46

Browse files
committed
Check if primal method exists
1 parent 48b46ab commit 620ef46

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/DualTest.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,13 @@ for N in (0,3), M in (0,4), V in (Int, Float32)
545545
@test dual_isapprox(logabsgamma(FDNUM)[1], loggamma(abs(FDNUM)))
546546
@test dual_isapprox(logabsgamma(FDNUM)[2], sign(gamma(FDNUM)))
547547

548-
a = rand()
548+
a = rand(float(V))
549549
fdnum = Dual{TestTag()}(1 + PRIMAL, PARTIALS) # 1 + PRIMAL avoids issues with finite differencing close to 0
550550
for ind in ((), (0,), (1,), (2,))
551+
# Only test if primal method exists
552+
# (e.g., older versions of SpecialFunctions don't define `gamma_inc(a, x)` but only `gamma_inc(a, x, ind)`
553+
hasmethod(gamma_inc, typeof((a, 1 + PRIMAL, ind...))) || continue
554+
551555
pq = gamma_inc(a, fdnum, ind...)
552556
@test pq isa Tuple{Dual{TestTag()},Dual{TestTag()}}
553557
# We have to adjust tolerances if lower accuracy is requested

0 commit comments

Comments
 (0)