Mercurial > repos > public > sbplib_julia
comparison test/Grids/equidistant_grid_test.jl @ 1565:c3425b4302b8 feature/grids/manifolds
Add equidistant_grid method for HyperBox
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Thu, 25 Apr 2024 13:21:12 +0200 |
| parents | 43aaf710463e |
| children | d4a6f9effcdd |
comparison
equal
deleted
inserted
replaced
| 1564:35fe4375b35f | 1565:c3425b4302b8 |
|---|---|
| 1 using Sbplib.Grids | 1 using Sbplib.Grids |
| 2 using Test | 2 using Test |
| 3 using Sbplib.RegionIndices | 3 using Sbplib.RegionIndices |
| 4 using Sbplib.LazyTensors | 4 using Sbplib.LazyTensors |
| 5 using StaticArrays | |
| 5 | 6 |
| 6 | 7 |
| 7 @testset "EquidistantGrid" begin | 8 @testset "EquidistantGrid" begin |
| 8 @test EquidistantGrid(0:0.1:10) isa EquidistantGrid | 9 @test EquidistantGrid(0:0.1:10) isa EquidistantGrid |
| 9 @test EquidistantGrid(range(0,1,length=10)) isa EquidistantGrid | 10 @test EquidistantGrid(range(0,1,length=10)) isa EquidistantGrid |
| 141 (0.,0.) (0.,7.11/2) (0.,7.11)] | 142 (0.,0.) (0.,7.11/2) (0.,7.11)] |
| 142 for i ∈ eachindex(gp) | 143 for i ∈ eachindex(gp) |
| 143 @test [gp[i]...] ≈ [p[i]...] atol=5e-13 | 144 @test [gp[i]...] ≈ [p[i]...] atol=5e-13 |
| 144 end | 145 end |
| 145 end | 146 end |
| 147 | |
| 148 | |
| 149 @testset "equidistant_grid(::ParameterSpace)" begin | |
| 150 ps = HyperBox((0,0),(2,1)) | |
| 151 | |
| 152 @test equidistant_grid(ps, 3,4) == equidistant_grid((0,0), (2,1), 3,4) | |
| 153 end | |
| 146 end | 154 end |
| 147 | 155 |
| 148 | 156 |
| 149 @testset "change_length" begin | 157 @testset "change_length" begin |
| 150 @test Grids.change_length(0:20, 21) == 0:20 | 158 @test Grids.change_length(0:20, 21) == 0:20 |
