diff test/Grids/tensor_grid_test.jl @ 1823:054447ac4b0e feature/grids/tensor_grid/spacing

Resolve review comments by filtering ZeroDimGrids
author Jonatan Werpers <jonatan@werpers.com>
date Sun, 20 Oct 2024 20:58:44 +0200
parents 189e69d44056
children 516eaabf1169
line wrap: on
line diff
--- a/test/Grids/tensor_grid_test.jl	Sun Oct 20 20:38:39 2024 +0200
+++ b/test/Grids/tensor_grid_test.jl	Sun Oct 20 20:58:44 2024 +0200
@@ -140,8 +140,22 @@
     @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