Skip to content

Commit

Permalink
Adopt tests for 32-bit systems
Browse files Browse the repository at this point in the history
  • Loading branch information
goggle committed Nov 12, 2019
1 parent 33a41dc commit ecafd6f
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions stdlib/SparseArrays/test/sparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2217,6 +2217,7 @@ end
show(io, MIME"text/plain"(), sparse(Int64[1, 1], Int64[1, 2], [1.0, 2.0]))
@test String(take!(io)) == "1×2 SparseArrays.SparseMatrixCSC{Float64,Int64} with 2 stored entries:\n"

# every 1-dot braille pattern
for (i, b) in enumerate(split("⠁⠂⠄⡀⠈⠐⠠⢀", ""))
A = spzeros(Int64, Int64, 4, 2)
A[i] = 1
Expand All @@ -2237,22 +2238,27 @@ end
brailleString = "⠑⢄" * Char(10240)^3 * "\n" * Char(10240)^2 * "⠑⢄" * Char(10240) * "\n" * Char(10240)^4 * ""
@test String(take!(io)) == "10×10 SparseArrays.SparseMatrixCSC{Float64,Int64} with 10 stored entries:\n" * brailleString

function _filled_sparse(m::Integer, n::Integer)
C = CartesianIndices(zeros(m, n))[:]
Is = [Int64(x[1]) for x in C]
Js = [Int64(x[2]) for x in C]
return sparse(Is, Js, true, m, n)
end

# vertical scaling
ioc = IOContext(io, :displaysize => (5, 80), :limit => true)
A = sparse(ones(Bool, 10, 10))
show(ioc, MIME"text/plain"(), A)
show(ioc, MIME"text/plain"(), _filled_sparse(10, 10))
@test String(take!(io)) == "10×10 SparseArrays.SparseMatrixCSC{Bool,Int64} with 100 stored entries:\n" * "⣿⣿"

A = sparse(ones(Bool, 20, 10))
show(ioc, MIME"text/plain"(), A)
show(ioc, MIME"text/plain"(), _filled_sparse(20, 10))
@test String(take!(io)) == "20×10 SparseArrays.SparseMatrixCSC{Bool,Int64} with 200 stored entries:\n" * ""

# horizontal scaling
ioc = IOContext(io, :displaysize => (80, 4), :limit => true)
A = sparse(ones(Bool, 8, 8))
show(ioc, MIME"text/plain"(), A)
show(ioc, MIME"text/plain"(), _filled_sparse(8, 8))
@test String(take!(io)) == "8×8 SparseArrays.SparseMatrixCSC{Bool,Int64} with 64 stored entries:\n" * "⣿⣿"

A = sparse(ones(Bool, 8, 16))
show(ioc, MIME"text/plain"(), A)
show(ioc, MIME"text/plain"(), _filled_sparse(8, 16))
@test String(take!(io)) == "8×16 SparseArrays.SparseMatrixCSC{Bool,Int64} with 128 stored entries:\n" * "⠛⠛"
end

Expand Down

0 comments on commit ecafd6f

Please sign in to comment.