Mercurial > repos > public > sbplib_julia
comparison test/Grids/equidistant_grid_test.jl @ 1902:f93ba5832146 feature/grids/parameter_spaces
Copy changes related to ParameterSpace from feature/grids/manifolds
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sat, 01 Feb 2025 22:12:53 +0100 |
parents | 871f3f1decea |
children | 04c251bccbd4 |
comparison
equal
deleted
inserted
replaced
1900:418566cdd689 | 1902:f93ba5832146 |
---|---|
1 using Diffinitive.Grids | 1 using Diffinitive.Grids |
2 using Test | 2 using Test |
3 using Diffinitive.LazyTensors | 3 using Diffinitive.LazyTensors |
4 using StaticArrays | |
4 | 5 |
5 | 6 |
6 @testset "EquidistantGrid" begin | 7 @testset "EquidistantGrid" begin |
7 @test EquidistantGrid(0:0.1:10) isa EquidistantGrid | 8 @test EquidistantGrid(0:0.1:10) isa EquidistantGrid |
8 @test EquidistantGrid(range(0,1,length=10)) isa EquidistantGrid | 9 @test EquidistantGrid(range(0,1,length=10)) isa EquidistantGrid |
151 (0.,0.) (0.,7.11/2) (0.,7.11)] | 152 (0.,0.) (0.,7.11/2) (0.,7.11)] |
152 for i ∈ eachindex(gp) | 153 for i ∈ eachindex(gp) |
153 @test [gp[i]...] ≈ [p[i]...] atol=5e-13 | 154 @test [gp[i]...] ≈ [p[i]...] atol=5e-13 |
154 end | 155 end |
155 end | 156 end |
157 | |
158 @testset "equidistant_grid(::ParameterSpace)" begin | |
159 ps = HyperBox((0,0),(2,1)) | |
160 | |
161 @test equidistant_grid(ps, 3,4) == equidistant_grid((0,0), (2,1), 3,4) | |
162 | |
163 @test equidistant_grid(unitinterval(),3) == equidistant_grid(0,1,3) | |
164 @test equidistant_grid(HyperBox((0,),(2,)),4) == equidistant_grid(@SVector[0], @SVector[2], 4) | |
165 end | |
156 end | 166 end |
157 | 167 |
158 | 168 |
159 @testset "change_length" begin | 169 @testset "change_length" begin |
160 @test Grids.change_length(0:20, 21) == 0:20 | 170 @test Grids.change_length(0:20, 21) == 0:20 |