From 7bc3561be1238d8e0fcf2e71fc36e89b9c34af25 Mon Sep 17 00:00:00 2001 From: nrontsis Date: Thu, 27 Oct 2022 18:54:23 +0100 Subject: [PATCH] Fix tests --- src/array_interface.jl | 2 ++ src/axis.jl | 2 +- test/runtests.jl | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/array_interface.jl b/src/array_interface.jl index fda942c8..8359b5fa 100644 --- a/src/array_interface.jl +++ b/src/array_interface.jl @@ -31,6 +31,8 @@ function Base.cat(inputs::ComponentArray...; dims::Int) end end +Base.hcat(inputs::ComponentArray...) = Base.cat(inputs...; dims=2) +Base.vcat(inputs::ComponentArray...) = Base.cat(inputs...; dims=1) function Base._typed_hcat(::Type{T}, inputs::Base.AbstractVecOrTuple{ComponentArray}) where {T} return Base.cat(map(i -> T.(i), inputs)...; dims=2) end diff --git a/src/axis.jl b/src/axis.jl index 29ea4222..4ffecc68 100644 --- a/src/axis.jl +++ b/src/axis.jl @@ -148,7 +148,7 @@ Base.keys(ax::AbstractAxis) = keys(indexmap(ax)) reindex(i, offset) = i .+ offset reindex(ax::FlatAxis, _) = ax reindex(ax::Axis, offset) = Axis(map(x->reindex(x, offset), indexmap(ax))) -reindex(ax::ViewAxis, offset) = ViewAxis(viewindex(ax) .+ offset, indexmap(ax)) +reindex(ax::ViewAxis{Inds,IdxMap,Ax}, offset) where {Inds, IdxMap, Ax} = ViewAxis(viewindex(ax) .+ offset, Ax()) # Get AbstractAxis index @inline Base.getindex(::AbstractAxis, idx) = ComponentIndex(idx) diff --git a/test/runtests.jl b/test/runtests.jl index a9d405eb..8560eae3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -507,7 +507,7 @@ end @test length(vtempca) == length(temp) + length(ca) @test [ca; ca; ca] isa Vector @test vcat(ca, 100) isa Vector - @test [ca' ca']' isa Vector + @test [ca' ca']' isa Adjoint{T, Matrix{T}} where T @test keys(getaxes([ca' temp']')[1]) == (:a, :b, :c, :q, :r) # Getting serious about axes