Skip to content

Commit

Permalink
test combinedims
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz committed Aug 31, 2023
1 parent 54a29cc commit 5d806d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Dimensions/primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,8 @@ function combinedims(xs::Vector; kw...)
()
end
end
combinedims(xs...; kw...) = combinedims(map(dims, xs)...; kw...)
combinedims(; kw...) = ()
combinedims(x1, xs...; kw...) = combinedims(map(dims, (x1, xs...))...; kw...)
combinedims(dt1::DimTupleOrEmpty; kw...) = dt1
combinedims(dt1::DimTupleOrEmpty, dt2::DimTupleOrEmpty, dimtuples::DimTupleOrEmpty...; kw...) =
reduce((dt2, dimtuples...); init=dt1) do dims1, dims2
Expand Down
1 change: 1 addition & 0 deletions test/primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ end

@testset "combinedims" begin
@test combinedims((X(1:10), Y(1:5)), (X(1:10), Z(3:10))) == (X(1:10), Y(1:5), Z(3:10))
@test combinedims([]) == combinedims() == ()
@test_throws DimensionMismatch combinedims((X(1:2), Y(1:5)), (X(1:10), Z(3:10)))
end

Expand Down

0 comments on commit 5d806d3

Please sign in to comment.