Skip to content

Commit a9a1a4c

Browse files
committed
Add heatmap tests
1 parent 2ab9c78 commit a9a1a4c

3 files changed

Lines changed: 336 additions & 17 deletions

File tree

spec/fixtures/generate_julia_heatmap_data.jl

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,36 @@ end
2121
function main()
2222
rng = StableRNG(1_337)
2323

24-
seed!(rng, 1_337)
25-
x60 = randn(rng, 60, 60)
26-
27-
seed!(rng, 1_337)
28-
x10 = randn(rng, 10, 10)
29-
30-
seed!(rng, 1_337)
31-
x11 = randn(rng, 10, 11)
24+
dims = [
25+
(60, 60),
26+
(10, 10),
27+
(10, 11),
28+
(1, 1),
29+
(1, 2),
30+
(2, 1),
31+
(10, 15),
32+
(15, 10),
33+
(20, 200),
34+
(200, 20),
35+
]
36+
37+
mats = Dict{String, Matrix{Float64}}()
38+
for (m, n) in dims
39+
seed!(rng, 1_337)
40+
mats["$(m)x$(n)"] = randn(rng, m, n)
41+
end
3242

3343
out_path = joinpath(@__DIR__, "julia_heatmap_data.json")
3444
open(out_path, "w") do io
3545
println(io, "{")
3646
println(io, " \"generated_by\": \"spec/fixtures/generate_julia_heatmap_data.jl\",")
3747
println(io, " \"seed\": 1337,")
38-
print(io, " \"60x60\": ")
39-
write_matrix_json(io, x60)
40-
println(io, ",")
41-
print(io, " \"10x10\": ")
42-
write_matrix_json(io, x10)
43-
println(io, ",")
44-
print(io, " \"10x11\": ")
45-
write_matrix_json(io, x11)
46-
println(io)
48+
for (idx, (m, n)) in enumerate(dims)
49+
key = "$(m)x$(n)"
50+
print(io, " \"$(key)\": ")
51+
write_matrix_json(io, mats[key])
52+
idx < length(dims) ? println(io, ",") : println(io)
53+
end
4754
println(io, "}")
4855
end
4956

0 commit comments

Comments
 (0)