diff --git a/test/interface.jl b/test/interface.jl index ad3be15..33ea409 100644 --- a/test/interface.jl +++ b/test/interface.jl @@ -126,23 +126,6 @@ end end end -@testset "similar_array_type_Diagonal" begin - z = zeros(2, 2) - y = MA.operate!!(MA.add_mul, z, big(1), LinearAlgebra.I(2)) - @test y == BigFloat[1 0; 0 1] - y = MA.operate!!(MA.add_mul, z, 2.4, LinearAlgebra.I(2)) - @test y === z - @test y == Float64[2.4 0; 0 2.4] - z = zeros(2, 2) - y = MA.operate!!(MA.add_mul, z, 2.4, LinearAlgebra.Diagonal(1:2)) - @test y == LinearAlgebra.Diagonal(2.4 * (1:2)) -end - -@testset "similar_array_type" begin - @test MA.similar_array_type(BitArray{2}, Int) == Array{Int,2} - @test MA.similar_array_type(BitArray{2}, Bool) == BitArray{2} -end - @testset "add_mul for BitArray" begin x = BigInt[0, 0] MA.operate!!(MA.add_mul, x, big(2), trues(2)) @@ -155,3 +138,20 @@ end MA.operate!!(MA.add_mul, x, big(3), BitArray([true false; true true])) @test x == BigInt[5 2; 5 5] end + +@testset "similar_array_type" begin + @test MA.similar_array_type(BitArray{2}, Int) == Array{Int,2} + @test MA.similar_array_type(BitArray{2}, Bool) == BitArray{2} +end + +@testset "similar_array_type_Diagonal" begin + z = zeros(2, 2) + y = MA.operate!!(MA.add_mul, z, big(1), LinearAlgebra.I(2)) + @test y == BigFloat[1 0; 0 1] + y = MA.operate!!(MA.add_mul, z, 2.4, LinearAlgebra.I(2)) + @test y === z + @test y == Float64[2.4 0; 0 2.4] + z = zeros(2, 2) + y = MA.operate!!(MA.add_mul, z, 2.4, LinearAlgebra.Diagonal(1:2)) + @test y == LinearAlgebra.Diagonal(2.4 * (1:2)) +end