Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott committed Jun 1, 2021
1 parent e1a350d commit 732aeb4
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,19 +202,21 @@ using StaticArrays, Test, LinearAlgebra
end

@testset "permutedims" begin
# vector -> one-row matrix
@test @inferred(permutedims(SVector(1,2,3))) === SMatrix{1,3}(1,2,3)
@test @inferred(permutedims(MVector(1,2,3))) == MMatrix{1,3}(1,2,3)
@test @inferred(permutedims(MVector(1,2,3))) isa MMatrix{1,3}
@test @inferred(permutedims(SizedVector{3}(rand(3)))) isa SizedMatrix{1,3}
@test @inferred(permutedims(MVector(1,2,3))) == [1 2 3]
@test @inferred(permutedims(SizedVector{3}([1,2,3]))) isa SizedMatrix{1,3}
@test @inferred(permutedims(SizedVector{3}([1,2,3]))) == [1 2 3]

# matrix
@test @inferred(permutedims(SMatrix{2,2}(1,2,3,4))) === SMatrix{2,2}(1,3,2,4)
@test @inferred(permutedims(MMatrix{2,2}(1,2,3,4))) == MMatrix{2,2}(1,3,2,4)
@test @inferred(permutedims(MMatrix{2,2}(1,2,3,4))) isa MMatrix{2,2}

A = rand(2,3)
@test @inferred(permutedims(SMatrix{2,3}(A))) === SMatrix{3,2}(A')
@test @inferred(permutedims(MMatrix{2,3}(A))) == MMatrix{3,2}(A')
@test @inferred(permutedims(SizedMatrix{2,3}(A))) == SizedMatrix{3,2}(A')
@test @inferred(permutedims(MMatrix{2,3}(A))) isa MMatrix{3,2}
@test @inferred(permutedims(MMatrix{2,3}(A))) == A'
@test @inferred(permutedims(SizedMatrix{2,3}(A))) isa SizedMatrix{3,2}
@test @inferred(permutedims(SizedMatrix{2,3}(A))) == A'
end

@testset "vcat() and hcat()" begin
Expand Down

0 comments on commit 732aeb4

Please sign in to comment.