From f92ea0bc0809b6f962e60322a591b6bb22000af0 Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Mon, 15 Dec 2025 06:39:56 +0200 Subject: [PATCH] test(topology): add segments test Test file included in main test/runtests.jl Tests segment element topology --- test/topology/test_segments.jl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/topology/test_segments.jl diff --git a/test/topology/test_segments.jl b/test/topology/test_segments.jl new file mode 100644 index 0000000..f322886 --- /dev/null +++ b/test/topology/test_segments.jl @@ -0,0 +1,28 @@ +# This file is a part of JuliaFEM. +# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md + +using JuliaFEM +using Test +using StaticArrays + +@testset "Segment Elements" begin + @testset "Segment{2}" begin + @test nnodes(Segment{2}()) == 2 + @test dim(Segment{2}()) == 1 + @test nvertices(Segment{2}()) == 2 + @test nedges(Segment{2}()) == 1 + @test nfaces(Segment{2}()) == 2 # Endpoints + + # Entity queries + @test nentities(Segment{2}, Vertex) == 2 + @test nentities(Segment{2}, Edge) == 1 + @test nentities(Segment{2}, Cell) == 1 + end + + @testset "Segment{3}" begin + @test nnodes(Segment{3}()) == 3 + @test nvertices(Segment{3}()) == 2 # Same topology as Segment{2} + @test nedges(Segment{3}()) == 1 + @test nentities(Segment{3}, Edge) == 1 + end +end