Skip to content

Commit 66f8b17

Browse files
committed
Add test for #385
1 parent 5b2369a commit 66f8b17

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/integral_tests.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ using DataInterpolations: integral
44
using Optim, ForwardDiff
55
using RegularizationTools
66
using StableRNGs
7+
using Unitful
78

89
function test_integral(method; args = [], kwargs = [], name::String)
910
func = method(args...; kwargs..., extrapolation_left = ExtrapolationType.Extension,
@@ -214,6 +215,13 @@ end
214215
@test_throws DataInterpolations.IntegralNotFoundError integral(A, 50.0)
215216
end
216217

218+
# issue #385
219+
@testset "Integrals with unitful numbers" begin
220+
u = rand(5)u"m"
221+
A = ConstantInterpolation(u, (1:5)u"s")
222+
@test @inferred(integral(A, 4u"s")) sum(u[1:3]) * u"s"
223+
end
224+
217225
@testset "cumulative_integral" begin
218226
A = ConstantInterpolation(["A", "B", "C"], [0.0, 0.25, 0.75])
219227
for cache_parameter in (true, false)

0 commit comments

Comments
 (0)