Skip to content

Commit

Permalink
Skip type inference tests for old Julia versions
Browse files Browse the repository at this point in the history
  • Loading branch information
sethaxen committed Oct 30, 2024
1 parent b1c533b commit fda4c36
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions test/hdi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ end
hdi_multimodal_sample(x, prob) = hdi(x; method=:multimodal_sample, prob)

x = rand(1_000)
@inferred hdi_unimodal(x, 0.9)
@inferred hdi_multimodal(x, 0.9)
@inferred hdi_multimodal_sample(x, 0.9)
if VERSION >= v"1.7"
@inferred hdi_unimodal(x, 0.9)
@inferred hdi_multimodal(x, 0.9)
@inferred hdi_multimodal_sample(x, 0.9)
end

@testset "$name" for (name, method) in methods
@test hdi(x; method=name, prob=0.9) == hdi(x; method, prob=0.9)
Expand All @@ -156,8 +158,13 @@ end
prob=0.9,
)
@test eltype(interval_discrete) === ClosedInterval{Int}
@test @inferred(hdi_multimodal(x, 0.9)) == interval_discrete
@test @inferred(hdi_multimodal_sample(x, 0.9)) == interval_discrete
if VERSION >= v"1.7"
@test @inferred(hdi_multimodal(x, 0.9)) == interval_discrete
@test @inferred(hdi_multimodal_sample(x, 0.9)) == interval_discrete
else
@test hdi_multimodal(x, 0.9) == interval_discrete
@test hdi_multimodal_sample(x, 0.9) == interval_discrete
end
end

@testset "Method-specific behavior" begin
Expand Down

0 comments on commit fda4c36

Please sign in to comment.