diff --git a/test/floating_point_types.jl b/test/floating_point_types.jl index 57d5a00b..7af87bd5 100644 --- a/test/floating_point_types.jl +++ b/test/floating_point_types.jl @@ -2,14 +2,19 @@ # have expected level of accuracy and are produce results in appropriate type # Base value for atol when integrating with a particular FP type -@testsnippet BaseAtol begin + +@testsnippet FP_Types begin + using LinearAlgebra: norm + using Meshes + using Unitful + baseatol = Dict( Float32 => 0.01f0, BigFloat => BigFloat(0.001) ) end -@testitem "Alternate floating types" setup=[Setup, BaseAtol] begin +@testitem "Alternate floating types" setup=[FP_Types] begin @testset "$FP" for FP in (Float32, BigFloat) # Rectangular volume with unit integrand f = p -> one(FP) @@ -41,7 +46,7 @@ end end end -@testitem "Integral Aliases" setup=[Setup] begin +@testitem "Integral Aliases" setup=[FP_Types] begin f = p -> one(Float32) box1d = Box(Point(fill(0.0f0u"m", 1)...), Point(fill(1.0f0u"m", 1)...)) box2d = Box(Point(fill(0.0f0u"m", 2)...), Point(fill(1.0f0u"m", 2)...)) diff --git a/test/runtests.jl b/test/runtests.jl index 380bff2d..3f981056 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,9 +3,3 @@ using TestItems # For CI, run all tests not marked with the :extended tag @run_package_tests filter=ti -> !(:extended in ti.tags) verbose=true - -@testsnippet Setup begin - using LinearAlgebra: norm - using Meshes - using Unitful -end diff --git a/test/utils.jl b/test/utils.jl index dcddbf3d..947688a7 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -1,7 +1,11 @@ -@testitem "Utilities" setup=[Setup] begin +@testsnippet Utils begin using LinearAlgebra: norm - using MeshIntegrals: _units, _zeros, _ones + using Meshes + using MeshIntegrals: _default_diff_method, _parametric, _units, _zeros, _ones + using Unitful +end +@testitem "Utilities" setup=[Utils] begin # _KVector v = Meshes.Vec(3, 4) @test norm(MeshIntegrals._KVector(v)) ≈ 5.0u"m" @@ -19,9 +23,7 @@ @test _ones(Float32, 2) == (1.0f0, 1.0f0) end -@testitem "Differentiation" setup=[Setup] begin - using MeshIntegrals: _default_diff_method - +@testitem "Differentiation" setup=[Utils] begin # _default_diff_method sphere = Sphere(Point(0, 0, 0), 1.0) @test _default_diff_method(Meshes.Sphere) isa FiniteDifference @@ -35,9 +37,7 @@ end @test_throws ArgumentError jacobian(box, zeros(3)) end -@testitem "_ParametricGeometry" setup=[Setup] begin - using MeshIntegrals: _parametric - +@testitem "_ParametricGeometry" setup=[Utils] begin pt_n = Point(0, 3, 0) pt_w = Point(-7, 0, 0) pt_e = Point(8, 0, 0)