diff --git a/test/runtests.jl b/test/runtests.jl index e97b8c8..ff3c121 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -17,16 +17,24 @@ using LinearAlgebra cube_path = raw"test_assets\cubeblender.stl" stl = load(cube_path) - @testset "get_mass_properties" begin + @testset "get_mass_properties function" begin props = get_mass_properties(stl) @test props.volume == 8.0 @test all(props.center_of_gravity .== 0.0) @test all(eigvals(props.inertia) .≈ (5.0 + 1 / 3)) - @testset "get_volume" begin + @testset "get_volume function" begin @test get_volume(stl; scale=1) ≈ props.volume rtol = 0.01 @test get_volume(stl; scale=4) ≈ (4 * 2)^3 rtol = 0.01 end end + @testset "Compare volumes with scaling" begin + for scale in 1:5 + props = get_mass_properties(stl; scale=scale) + volume = get_volume(stl; scale=scale) + + @test props.volume ≈ volume rtol = 0.01 + end + end end