Skip to content

Commit

Permalink
Added testing for meshgroup #20
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin-Mattheus-Moerman committed Mar 31, 2024
1 parent 53f1825 commit 7f7c438
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/demo_meshgroup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using GLMakie
using GeometryBasics

# Example geometry
testCase = 3
testCase = 1
if testCase == 1
s=1.0
V=Vector{GeometryBasics.Point{3, Float64}}(undef,5)
Expand Down
32 changes: 32 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ end
end
end


@testset "gridpoints" verbose = true begin

@testset "with 1 vector" begin
Expand Down Expand Up @@ -1903,6 +1904,37 @@ end

end

@testset "meshgroup" verbose = true begin
@testset "Single face" begin
# Single triangle
F = TriangleFace{Int64}[[1,2,3]]
V = Point3{Float64}[[0.0,0.0,0.0],[1.0,0.0,0.0],[1.0,1.0,0.0]]
C = meshgroup(F)
@test C == [1]

# Single quad
F = QuadFace{Int64}[[1,2,3,4]]
V = Point3{Float64}[[0.0,0.0,0.0],[1.0,0.0,0.0],[1.0,1.0,0.0],[0.0,1.0,0.0]]
C = meshgroup(F)
@test C == [1]
end

@testset "Two separate faces" begin
# Two triangles
F = TriangleFace{Int64}[[1,2,3],[4,5,6]]
V = Point3{Float64}[[0.0,0.0,0.0],[1.0,0.0,0.0],[1.0,1.0,0.0],
[0.0,0.0,1.0],[1.0,0.0,1.0],[1.0,1.0,1.0]]
C = meshgroup(F)
@test C == [1,2]

# Two quads
F = QuadFace{Int64}[[1,2,3,4],[5,6,7,8]]
V = Point3{Float64}[[0.0,0.0,0.0],[1.0,0.0,0.0],[1.0,1.0,0.0],[0.0,1.0,0.0],
[0.0,0.0,1.0],[1.0,0.0,1.0],[1.0,1.0,1.0],[0.0,1.0,1.0]]
C = meshgroup(F)
@test C == [1,2]
end
end

@testset "separate vertices" begin

Expand Down

0 comments on commit 7f7c438

Please sign in to comment.