Mercurial > repos > public > sbplib_julia
comparison test/Grids/geometry_test.jl @ 1968:35cb503985b6 feature/grids/geometry_functions
Add tests for linesegments and polygon_edges
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Wed, 12 Feb 2025 15:45:37 +0100 |
| parents | 669361a8195a |
| children | 7f4a5146c84c |
comparison
equal
deleted
inserted
replaced
| 1967:669361a8195a | 1968:35cb503985b6 |
|---|---|
| 1 using Diffinitive.Grids | 1 using Diffinitive.Grids |
| 2 using Diffinitive.Grids: Line, LineSegment | 2 using Diffinitive.Grids: Line, LineSegment, linesegments, polygon_edges |
| 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}} |
| 43 @test l(1/2) == [1,2]/2 + [2,3]/2 | 43 @test l(1/2) == [1,2]/2 + [2,3]/2 |
| 44 end | 44 end |
| 45 end | 45 end |
| 46 | 46 |
| 47 @testset "linesegments" begin | 47 @testset "linesegments" begin |
| 48 @testset "Constructors" begin | 48 a,b,c,d = [1,1],[2,2],[3,3],[4,4] |
| 49 end | 49 @test linesegments(a,b) == [ |
| 50 LineSegment(a,b), | |
| 51 ] | |
| 50 | 52 |
| 51 @test_broken false | 53 @test linesegments(a,b,c) == [ |
| 54 LineSegment(a,b), | |
| 55 LineSegment(b,c), | |
| 56 ] | |
| 57 | |
| 58 @test linesegments(a,b,c,d) == [ | |
| 59 LineSegment(a,b), | |
| 60 LineSegment(b,c), | |
| 61 LineSegment(c,d), | |
| 62 ] | |
| 52 end | 63 end |
| 53 | 64 |
| 54 @testset "polygon_edges" begin | 65 @testset "polygon_edges" begin |
| 55 @testset "Constructors" begin | 66 a,b,c,d = [1,1],[2,2],[3,3],[4,4] |
| 56 end | 67 @test polygon_edges(a,b) == [ |
| 68 LineSegment(a,b), | |
| 69 LineSegment(b,a), | |
| 70 ] | |
| 57 | 71 |
| 58 @test_broken false | 72 @test polygon_edges(a,b,c) == [ |
| 73 LineSegment(a,b), | |
| 74 LineSegment(b,c), | |
| 75 LineSegment(c,a), | |
| 76 ] | |
| 77 | |
| 78 @test polygon_edges(a,b,c,d) == [ | |
| 79 LineSegment(a,b), | |
| 80 LineSegment(b,c), | |
| 81 LineSegment(c,d), | |
| 82 LineSegment(d,a), | |
| 83 ] | |
| 59 end | 84 end |
| 60 | 85 |
| 61 @testset "Circle" begin | 86 @testset "Circle" begin |
| 62 @testset "Constructors" begin | 87 @testset "Constructors" begin |
| 63 end | 88 end |
