Skip to content

Commit e250879

Browse files
committed
Add tests
1 parent da1ccdc commit e250879

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

test/type_stability.jl

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,41 @@ end;
162162
@inferred decompress(B, result)
163163
end
164164
end;
165+
166+
@testset "Single precision" begin
167+
A = convert(
168+
SparseMatrixCSC{Float32,Int32},
169+
sparse(Symmetric(sprand(rng, Float32, 100, 100, 0.1))),
170+
)
171+
@testset "$structure - $partition - $decompression" for (
172+
structure, partition, decompression
173+
) in [
174+
(:nonsymmetric, :column, :direct),
175+
(:nonsymmetric, :row, :direct),
176+
(:symmetric, :column, :direct),
177+
(:symmetric, :column, :substitution),
178+
(:nonsymmetric, :bidirectional, :direct),
179+
(:nonsymmetric, :bidirectional, :substitution),
180+
]
181+
result = coloring(
182+
A,
183+
ColoringProblem(; structure, partition),
184+
GreedyColoringAlgorithm(; decompression);
185+
)
186+
if partition in (:column, :bidirectional)
187+
@test eltype(column_colors(result)) == Int32
188+
@test eltype(column_groups(result)[1]) == Int32
189+
end
190+
if partition in (:row, :bidirectional)
191+
@test eltype(row_colors(result)) == Int32
192+
@test eltype(row_groups(result)[1]) == Int32
193+
end
194+
if partition == :bidirectional
195+
Br, Bc = compress(A, result)
196+
@test decompress(Br, Bc, result) isa SparseMatrixCSC{Float32,Int32}
197+
else
198+
B = compress(A, result)
199+
@test decompress(B, result) isa SparseMatrixCSC{Float32,Int32}
200+
end
201+
end
202+
end

0 commit comments

Comments
 (0)