|
1 | 1 | @testset "descendants" begin
|
2 |
| - mtg = read_mtg("files/simple_plant.mtg"); |
3 |
| - width_all = [nothing,nothing,1.0,6.0,nothing,7.0] |
4 |
| - @test descendants(mtg, :Width; type = Union{Nothing,Float64}) == width_all |
5 |
| - @test descendants(mtg, :Width) == width_all |
| 2 | + mtg = read_mtg("files/simple_plant.mtg") |
| 3 | + width_all = [nothing, nothing, 0.02, 0.1, 0.02, 0.1] |
| 4 | + @test descendants(mtg, :Width; type = Union{Nothing,Float64}) == width_all |
| 5 | + @test descendants(mtg, :Width) == width_all |
6 | 6 |
|
7 | 7 | d = descendants(mtg, :Width, scale = 1)
|
8 | 8 | @test typeof(d) == Vector{Any}
|
9 | 9 | @test length(d) == 1
|
10 |
| - @test d[1] == width_all[1] |
| 10 | + @test d[1] === width_all[1] |
11 | 11 | d_typed = descendants(mtg, :Width, type = Union{Nothing,Float64})
|
12 |
| - @test typeof(d_typed) == Vector{Union{Nothing,Float64}} |
| 12 | + @test typeof(d_typed) == Vector{Union{Nothing,Float64}} |
13 | 13 | @test descendants(mtg, :Width, symbol = ("Leaf", "Internode")) == width_all[3:end]
|
14 | 14 |
|
15 | 15 | mtg2 = mtg[1][1][1][2]
|
16 | 16 | @test descendants(mtg2, :Width, symbol = "Leaf")[1] == width_all[end]
|
17 | 17 |
|
18 | 18 | @test descendants(mtg2, :Width, symbol = ("Leaf", "Internode"), self = true) ==
|
19 |
| - width_all[end - 1:end] |
| 19 | + width_all[end-1:end] |
20 | 20 |
|
21 | 21 | # Using the mutating version:
|
22 | 22 | @test descendants!(mtg, :Width) == descendants(mtg, :Width)
|
23 | 23 | @test descendants!(mtg2, :Width, symbol = ("Leaf", "Internode"), self = true) ==
|
24 |
| - width_all[end - 1:end] |
| 24 | + width_all[end-1:end] |
25 | 25 |
|
26 | 26 | clean_cache!(mtg)
|
27 | 27 | # Get the leaves values:
|
28 |
| - @test descendants(mtg, :Width; filter_fun = isleaf) == width_all[[end - 2,end]] |
| 28 | + @test descendants(mtg, :Width; filter_fun = isleaf) == width_all[[end - 2, end]] |
29 | 29 |
|
30 | 30 |
|
31 | 31 | # descendants!(mtg, :Width, symbol = ("Leaf", "Internode"), self = true)
|
|
0 commit comments