diff test/Grids/tensor_grid_test.jl @ 1868:81559cb7b11c feature/grids/manifolds

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 23 Jan 2025 23:22:11 +0100
parents 054447ac4b0e
children 516eaabf1169
line wrap: on
line diff
--- a/test/Grids/tensor_grid_test.jl	Tue Nov 12 18:15:27 2024 +0100
+++ b/test/Grids/tensor_grid_test.jl	Thu Jan 23 23:22:11 2025 +0100
@@ -137,6 +137,27 @@
         @test axes(g) == (1:11,1:6)
     end
 
+    @testset "spacing" begin
+        g₁ = EquidistantGrid(range(0,1,length=11))
+        g₂ = EquidistantGrid(range(2,3,length=6))
+        g₃ = ZeroDimGrid(@SVector[1,2])
+
+        @test spacing(TensorGrid(g₁)) == (1/10,)
+        @test spacing(TensorGrid(g₂)) == (1/5,)
+
+        @test spacing(TensorGrid(g₁, g₂)) == (1/10, 1/5)
+
+        @test spacing(TensorGrid(g₁, g₃)) == (1/10,)
+        @test spacing(TensorGrid(g₃, g₂)) == (1/5,)
+
+
+        @test spacing(TensorGrid(g₁, g₂, g₁)) == (1/10, 1/5, 1/10)
+
+        @test spacing(TensorGrid(g₃, g₂, g₁)) == (1/5, 1/10)
+        @test spacing(TensorGrid(g₁, g₃, g₁)) == (1/10, 1/10)
+        @test spacing(TensorGrid(g₁, g₂, g₃)) == (1/10, 1/5)
+    end
+
     @testset "min_spacing" begin
         g₁ = EquidistantGrid(range(0,1,length=11))
         g₂ = EquidistantGrid(range(2,3,length=6))