comparison test/Grids/equidistant_grid_test.jl @ 1719:d81d0660b80d

Merge refactor/grids/boundary_identifiers_1d
author Vidar Stiernström <vidar.stiernstrom@gmail.com>
date Thu, 05 Sep 2024 08:26:12 -0700
parents b5690ab5f0b8
children 471a948cd2b2
comparison
equal deleted inserted replaced
1716:fe298044e044 1719:d81d0660b80d
1 using Sbplib.Grids 1 using Sbplib.Grids
2 using Test 2 using Test
3 using Sbplib.RegionIndices
4 using Sbplib.LazyTensors 3 using Sbplib.LazyTensors
5 4
6 5
7 @testset "EquidistantGrid" begin 6 @testset "EquidistantGrid" begin
8 @test EquidistantGrid(0:0.1:10) isa EquidistantGrid 7 @test EquidistantGrid(0:0.1:10) isa EquidistantGrid
61 @test min_spacing(EquidistantGrid(0:0.1:10)) == 0.1 60 @test min_spacing(EquidistantGrid(0:0.1:10)) == 0.1
62 end 61 end
63 62
64 @testset "boundary_identifiers" begin 63 @testset "boundary_identifiers" begin
65 g = EquidistantGrid(0:0.1:10) 64 g = EquidistantGrid(0:0.1:10)
66 @test boundary_identifiers(g) == (Lower(), Upper()) 65 @test boundary_identifiers(g) == (LowerBoundary(), UpperBoundary())
67 @inferred boundary_identifiers(g) 66 @inferred boundary_identifiers(g)
68 end 67 end
69 68
70 @testset "boundary_grid" begin 69 @testset "boundary_grid" begin
71 g = EquidistantGrid(0:0.1:1) 70 g = EquidistantGrid(0:0.1:1)
72 @test boundary_grid(g, Lower()) == ZeroDimGrid(0.0) 71 @test boundary_grid(g, LowerBoundary()) == ZeroDimGrid(0.0)
73 @test boundary_grid(g, Upper()) == ZeroDimGrid(1.0) 72 @test boundary_grid(g, UpperBoundary()) == ZeroDimGrid(1.0)
74 end 73 end
75 74
76 @testset "boundary_indices" begin 75 @testset "boundary_indices" begin
77 g = EquidistantGrid(0:0.1:1) 76 g = EquidistantGrid(0:0.1:1)
78 @test boundary_indices(g, Lower()) == (1,) 77 @test boundary_indices(g, LowerBoundary()) == (1,)
79 @test boundary_indices(g, Upper()) == (11,) 78 @test boundary_indices(g, UpperBoundary()) == (11,)
80 79
81 g = EquidistantGrid(2:0.1:10) 80 g = EquidistantGrid(2:0.1:10)
82 @test boundary_indices(g, Lower()) == (1,) 81 @test boundary_indices(g, LowerBoundary()) == (1,)
83 @test boundary_indices(g, Upper()) == (81,) 82 @test boundary_indices(g, UpperBoundary()) == (81,)
84 83
85 end 84 end
86 85
87 @testset "refine" begin 86 @testset "refine" begin
88 g = EquidistantGrid(0:0.1:1) 87 g = EquidistantGrid(0:0.1:1)