diff --git a/test/operations.jl b/test/operations.jl index 605a4a9..5e8dae6 100644 --- a/test/operations.jl +++ b/test/operations.jl @@ -5,4 +5,22 @@ op(p...) end end + + function looped_op(;ct = 5, op = diff) + + hole_interval = 10/(ct + 1) + + c = Square([10,10]) + + for i = 1:ct + h = translate([hole_interval*i, 10/2])Circle(1) + c = op(c, h) + end + end + + # test type stability of setops in a loop + @test typeof(looped_op(;ct=3, op=diff)) == typeof(looped_op(;ct=5, op=diff)) + @test typeof(looped_op(;ct=3, op=union)) == typeof(looped_op(;ct=5, op=union)) + @test typeof(looped_op(;ct=3, op=intersect)) == typeof(looped_op(;ct=5, op=intersect)) + end diff --git a/test/runtests.jl b/test/runtests.jl index 2ab8fdc..35662bc 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,4 +1,4 @@ -using Descartes: Sphere, Cuboid, Cylinder, CSGUnion, CSGIntersect, CSGDiff, MapContainer, Piping, FRep, Square, translate, rotate, Shell, RadiusedCSGUnion +using Descartes: Sphere, Cuboid, Cylinder, CSGUnion, CSGIntersect, CSGDiff, MapContainer, Piping, FRep, Square, Circle, translate, rotate, Shell, RadiusedCSGUnion, LinearExtrude using StaticArrays using Test using Combinatorics