Skip to content

Commit a0da449

Browse files
committed
Always use isapprox in test_density_interface
1 parent c66d3e3 commit a0da449

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/interface_test.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file is a part of DensityInterface.jl, licensed under the MIT License (MIT).
22

33
"""
4-
DensityInterface.test_density_interface(d, x, ref_logd_at_x; compare=isapprox, kwargs...)
4+
DensityInterface.test_density_interface(d, x, ref_logd_at_x; kwargs...)
55
66
Test if `d` is compatible with `DensityInterface`.
77
@@ -13,26 +13,26 @@ Also tests if `logfuncdensity(logdensityof(d))` returns
1313
a density equivalent to `d` in respect to the functions above.
1414
1515
The results of `logdensityof(d, x)` and `densityof(d, x)` are compared to
16-
`ref_logd_at_x` and `exp(ref_logd_at_x)` using `compare`. `kwargs...` are
17-
forwarded to `compare`.
16+
`ref_logd_at_x` and `exp(ref_logd_at_x)` using `isapprox`. `kwargs...` are
17+
forwarded to `isapprox`.
1818
"""
19-
function test_density_interface(d, x, ref_logd_at_x; compare=isapprox, kwargs...)
19+
function test_density_interface(d, x, ref_logd_at_x; kwargs...)
2020
@testset "test_density_interface: $d with input $x" begin
2121
ref_d_at_x = exp(ref_logd_at_x)
2222

2323
@test hasdensity(d) == true
24-
@test compare(logdensityof(d, x), ref_logd_at_x; kwargs...)
24+
@test isapprox(logdensityof(d, x), ref_logd_at_x; kwargs...)
2525
log_f = logdensityof(d)
26-
@test compare(log_f(x), ref_logd_at_x; kwargs...)
27-
@test compare(densityof(d,x), ref_d_at_x; kwargs...)
28-
@test compare(densityof(d)(x), ref_d_at_x; kwargs...)
26+
@test isapprox(log_f(x), ref_logd_at_x; kwargs...)
27+
@test isapprox(densityof(d,x), ref_d_at_x; kwargs...)
28+
@test isapprox(densityof(d)(x), ref_d_at_x; kwargs...)
2929

3030
d2 = logfuncdensity(log_f)
3131
@test hasdensity(d2) == true
32-
@test compare(logdensityof(d2, x), ref_logd_at_x; kwargs...)
32+
@test isapprox(logdensityof(d2, x), ref_logd_at_x; kwargs...)
3333
log_f2 = logdensityof(d2)
34-
@test compare(log_f2(x), ref_logd_at_x; kwargs...)
35-
@test compare(densityof(d2,x), ref_d_at_x; kwargs...)
36-
@test compare(densityof(d2)(x), ref_d_at_x; kwargs...)
34+
@test isapprox(log_f2(x), ref_logd_at_x; kwargs...)
35+
@test isapprox(densityof(d2,x), ref_d_at_x; kwargs...)
36+
@test isapprox(densityof(d2)(x), ref_d_at_x; kwargs...)
3737
end
3838
end

0 commit comments

Comments
 (0)