Skip to content

Commit

Permalink
Update types
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeingold authored Sep 20, 2024
1 parent 9ce8058 commit fd501a0
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ end
box1d = Box(Point(fill(zero(FP)*u"m", 1)...), Point(fill(one(FP)*u"m", 1)...))
box2d = Box(Point(fill(zero(FP)*u"m", 2)...), Point(fill(one(FP)*u"m", 2)...))
box3d = Box(Point(fill(zero(FP)*u"m", 3)...), Point(fill(one(FP)*u"m", 3)...))
box4d = Box(Point(fill(zero(FP)*u"m", 4)...), Point(fill(one(FP)*u"m", 4)...))

# Check HCubature integrals (same method invoked for all dimensions)
int_HC = integral(f, box1d, HAdaptiveCubature(), FP)
Expand All @@ -478,17 +477,20 @@ end

@testset "Integral Aliases" begin
f = p -> one(Float32)
box4d = Box(Point(fill(0.0f0u"m", 4)...), Point(fill(1.0f0u"m", 4)...))
box1d = Box(Point(fill(zero(Float32)*u"m", 1)...), Point(fill(one(Float32)*u"m", 1)...))
box2d = Box(Point(fill(zero(Float32)*u"m", 2)...), Point(fill(one(Float32)*u"m", 2)...))
box3d = Box(Point(fill(zero(Float32)*u"m", 3)...), Point(fill(one(Float32)*u"m", 3)...))
box4d = Box(Point(fill(zero(Float32)*u"m", 4)...), Point(fill(one(Float32)*u"m", 4)...))

# Check alias functions for accuracy
@test lineintegral(f, box1d, GaussLegendre(100), FP) 1.0f0u"m" atol=0.01f0u"m"
@test surfaceintegral(f, box2d, GaussLegendre(100), FP) 1.0f0u"m^2" atol=0.02f0u"m^2"
@test volumeintegral(f, box3d, GaussLegendre(100), FP) 1.0f0u"m^3" atol=0.03f0u"m^3"
@test lineintegral(f, box1d, GaussLegendre(100), Float32) 1.0f0u"m" atol=0.01f0u"m"
@test surfaceintegral(f, box2d, GaussLegendre(100), Float32) 1.0f0u"m^2" atol=0.02f0u"m^2"
@test volumeintegral(f, box3d, GaussLegendre(100), Float32) 1.0f0u"m^3" atol=0.03f0u"m^3"

# Check for unsupported use of alias functions
@test_throws "not supported" lineintegral(f, box4d, HAdaptiveCubature(), FP)
@test_throws "not supported" surfaceintegral(f, box4d, HAdaptiveCubature(), FP)
@test_throws "not supported" volumeintegral(f, box4d, HAdaptiveCubature(), FP)
@test_throws "not supported" lineintegral(f, box4d, HAdaptiveCubature(), Float32)
@test_throws "not supported" surfaceintegral(f, box4d, HAdaptiveCubature(), Float32)
@test_throws "not supported" volumeintegral(f, box4d, HAdaptiveCubature(), Float32)
end

end

0 comments on commit fd501a0

Please sign in to comment.