Mercurial > repos > public > sbplib_julia
comparison test/Grids/geometry_test.jl @ 1967:669361a8195a feature/grids/geometry_functions
Add tests and better constructors for LineSegment
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Wed, 12 Feb 2025 15:40:19 +0100 |
| parents | 478b233999c5 |
| children | 35cb503985b6 |
comparison
equal
deleted
inserted
replaced
| 1966:478b233999c5 | 1967:669361a8195a |
|---|---|
| 1 using Diffinitive.Grids | 1 using Diffinitive.Grids |
| 2 using Diffinitive.Grids: Line | 2 using Diffinitive.Grids: Line, LineSegment |
| 3 using StaticArrays | 3 using StaticArrays |
| 4 | 4 |
| 5 @testset "Line" begin | 5 @testset "Line" begin |
| 6 @testset "Constructors" begin | 6 @testset "Constructors" begin |
| 7 @test Line([1,2],[2,3]) isa Line{SVector{2,Int}} | 7 @test Line([1,2],[2,3]) isa Line{SVector{2,Int}} |
| 23 end | 23 end |
| 24 end | 24 end |
| 25 | 25 |
| 26 @testset "LineSegment" begin | 26 @testset "LineSegment" begin |
| 27 @testset "Constructors" begin | 27 @testset "Constructors" begin |
| 28 @test LineSegment([1,2],[2,3]) isa LineSegment{SVector{2,Int}} | |
| 29 @test LineSegment((1,2),(2,3)) isa LineSegment{SVector{2,Int}} | |
| 30 @test LineSegment(@SVector[1,2],[2,3]) isa LineSegment{SVector{2,Int}} | |
| 31 @test LineSegment(@SVector[1,2],@SVector[2,3]) isa LineSegment{SVector{2,Int}} | |
| 32 | |
| 33 @test LineSegment([1,2],[2.,3]) isa LineSegment{SVector{2,Float64}} | |
| 34 @test LineSegment(@SVector[1,2.],@SVector[2,3]) isa LineSegment{SVector{2,Float64}} | |
| 35 @test LineSegment((1,2.),(2,3)) isa LineSegment{SVector{2,Float64}} | |
| 28 end | 36 end |
| 29 | 37 |
| 30 @test_broken false | 38 @testset "Evaluation" begin |
| 39 l = LineSegment([1,2],[2,3]) | |
| 40 | |
| 41 @test l(0) == [1,2] | |
| 42 @test l(1) == [2,3] | |
| 43 @test l(1/2) == [1,2]/2 + [2,3]/2 | |
| 44 end | |
| 31 end | 45 end |
| 32 | 46 |
| 33 @testset "linesegments" begin | 47 @testset "linesegments" begin |
| 34 @testset "Constructors" begin | 48 @testset "Constructors" begin |
| 35 end | 49 end |
