Mercurial > repos > public > sbplib_julia
comparison test/Grids/geometry_test.jl @ 1966:478b233999c5 feature/grids/geometry_functions
Add tests and better constructors for Line
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 12 Feb 2025 15:33:48 +0100 |
parents | eedb5d7b90b4 |
children | 669361a8195a |
comparison
equal
deleted
inserted
replaced
1965:eedb5d7b90b4 | 1966:478b233999c5 |
---|---|
1 using Diffinitive.Grids | |
2 using Diffinitive.Grids: Line | |
3 using StaticArrays | |
4 | |
1 @testset "Line" begin | 5 @testset "Line" begin |
2 @test_broken false | |
3 @testset "Constructors" begin | 6 @testset "Constructors" begin |
7 @test Line([1,2],[2,3]) isa Line{SVector{2,Int}} | |
8 @test Line((1,2),(2,3)) isa Line{SVector{2,Int}} | |
9 @test Line(@SVector[1,2],[2,3]) isa Line{SVector{2,Int}} | |
10 @test Line(@SVector[1,2],@SVector[2,3]) isa Line{SVector{2,Int}} | |
11 | |
12 @test Line([1,2],[2.,3]) isa Line{SVector{2,Float64}} | |
13 @test Line(@SVector[1,2.],@SVector[2,3]) isa Line{SVector{2,Float64}} | |
14 @test Line((1,2.),(2,3)) isa Line{SVector{2,Float64}} | |
15 end | |
16 | |
17 @testset "Evaluation" begin | |
18 l = Line([1,2],[2,3]) | |
19 | |
20 @test l(0) == [1,2] | |
21 @test l(1) == [1,2] + [2,3] | |
22 @test l(1/2) == [1,2] + [2,3]/2 | |
4 end | 23 end |
5 end | 24 end |
6 | 25 |
7 @testset "LineSegment" begin | 26 @testset "LineSegment" begin |
8 @testset "Constructors" begin | 27 @testset "Constructors" begin |