Skip to content

Commit

Permalink
add setop tests in loop
Browse files Browse the repository at this point in the history
  • Loading branch information
sjkelly committed Jun 19, 2024
1 parent 51d92d8 commit 824f0b8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions test/operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 824f0b8

Please sign in to comment.