Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
vchuravy and github-actions[bot] authored Mar 19, 2024
1 parent 4c1fc66 commit 92bb808
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions test/typetree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ struct Composite
end

struct LList2{T}
next::Union{Nothing, LList2{T}}
v::T
next::Union{Nothing,LList2{T}}
v::T
end

struct Sibling{T}
a::T
b::T
a::T
b::T
end

struct Sibling2{T}
a::T
something::Bool
b::T
a::T
something::Bool
b::T
end

@testset "TypeTree" begin
Expand All @@ -57,9 +57,13 @@ end

@test tt(LList2{Float64}) == "{[8]:Float@double}"
@test tt(Sibling{LList2{Float64}}) == "{[-1]:Pointer, [-1,8]:Float@double}"
@test tt(Sibling2{LList2{Float64}}) == "{[0]:Pointer, [0,8]:Float@double, [8]:Integer, [16]:Pointer, [16,8]:Float@double}"
@test tt(Sibling{Tuple{Int, Float64}}) == "{[0]:Integer, [1]:Integer, [2]:Integer, [3]:Integer, [4]:Integer, [5]:Integer, [6]:Integer, [7]:Integer, [8]:Float@double, [16]:Integer, [17]:Integer, [18]:Integer, [19]:Integer, [20]:Integer, [21]:Integer, [22]:Integer, [23]:Integer, [24]:Float@double}"
@test tt(Sibling{LList2{Tuple{Int, Float64}}}) == "{[-1]:Pointer, [-1,8]:Integer, [-1,9]:Integer, [-1,10]:Integer, [-1,11]:Integer, [-1,12]:Integer, [-1,13]:Integer, [-1,14]:Integer, [-1,15]:Integer, [-1,16]:Float@double}"
@test tt(Sibling2{Sibling2{LList2{Tuple{Float32, Float64}}}}) == "{[0]:Pointer, [0,8]:Float@float, [0,16]:Float@double, [8]:Integer, [16]:Pointer, [16,8]:Float@float, [16,16]:Float@double, [24]:Integer, [32]:Pointer, [32,8]:Float@float, [32,16]:Float@double, [40]:Integer, [48]:Pointer, [48,8]:Float@float, [48,16]:Float@double}"
"{[0]:Pointer, [0,8]:Float@float, [0,16]:Float@double, [8]:Integer, [16]:Pointer, [16,8]:Float@float, [16,16]:Float@double, [24]:Integer, [32]:Pointer, [32,8]:Float@float, [32,16]:Float@double, [40]:Integer, [48]:Pointer, [48,8]:Float@float, [48,16]:Float@double}"
end
@test tt(Sibling2{LList2{Float64}}) ==
"{[0]:Pointer, [0,8]:Float@double, [8]:Integer, [16]:Pointer, [16,8]:Float@double}"
@test tt(Sibling{Tuple{Int,Float64}}) ==
"{[0]:Integer, [1]:Integer, [2]:Integer, [3]:Integer, [4]:Integer, [5]:Integer, [6]:Integer, [7]:Integer, [8]:Float@double, [16]:Integer, [17]:Integer, [18]:Integer, [19]:Integer, [20]:Integer, [21]:Integer, [22]:Integer, [23]:Integer, [24]:Float@double}"
@test tt(Sibling{LList2{Tuple{Int,Float64}}}) ==
"{[-1]:Pointer, [-1,8]:Integer, [-1,9]:Integer, [-1,10]:Integer, [-1,11]:Integer, [-1,12]:Integer, [-1,13]:Integer, [-1,14]:Integer, [-1,15]:Integer, [-1,16]:Float@double}"
@test tt(Sibling2{Sibling2{LList2{Tuple{Float32,Float64}}}}) ==
"{[0]:Pointer, [0,8]:Float@float, [0,16]:Float@double, [8]:Integer, [16]:Pointer, [16,8]:Float@float, [16,16]:Float@double, [24]:Integer, [32]:Pointer, [32,8]:Float@float, [32,16]:Float@double, [40]:Integer, [48]:Pointer, [48,8]:Float@float, [48,16]:Float@double}"
"{[0]:Pointer, [0,8]:Float@float, [0,16]:Float@double, [8]:Integer, [16]:Pointer, [16,8]:Float@float, [16,16]:Float@double, [24]:Integer, [32]:Pointer, [32,8]:Float@float, [32,16]:Float@double, [40]:Integer, [48]:Pointer, [48,8]:Float@float, [48,16]:Float@double}"
end

0 comments on commit 92bb808

Please sign in to comment.