diff test/Grids/geometry_test.jl @ 2013:7895b509f9bf feature/grids/geometry_functions

Implement Grids.jacobian for Arc
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 07 May 2025 15:25:25 +0200
parents 4617e4b74b82
children 5c2448d6a201
line wrap: on
line diff
--- a/test/Grids/geometry_test.jl	Wed May 07 08:39:06 2025 +0200
+++ b/test/Grids/geometry_test.jl	Wed May 07 15:25:25 2025 +0200
@@ -177,7 +177,28 @@
     @test a(1) ≈ [0,1]
 
     @testset "Grids.jacobian" begin
-        @test_broken false
+        c = Circle([0,0], 1)
+
+        @testset "Matched to circle" begin
+            a = Arc(c, 0, 1)
+            @testset for t ∈ range(0,1,8)
+                @test jacobian(a,t) ≈ jacobian(c,t)
+            end
+        end
+
+        @testset "Full circle" begin
+            a = Arc(c, 0, 2π)
+            @testset for t ∈ range(0,1,8)
+                @test jacobian(a,t) ≈ 2π*jacobian(c,t)
+            end
+        end
+
+        @testset "Other" begin
+            a = Arc(c, π/3, 5π/4)
+            @testset for t ∈ range(0,1,8)
+                @test jacobian(a,t) ≈ 11π/12*jacobian(c,t)
+            end
+        end
     end
 end