Skip to content

Commit

Permalink
init tests :)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmaccode authored May 10, 2024
1 parent 9174c81 commit 16c600d
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Test
using Gattino

df = Dict("A" => [5, 10, 15, 20], "B" => [1, 2, 3, 4])

@testset "gattino plots" verbose = true begin
@testset "high-level plotting" verbose = true begin
@testset "hist" begin
ran = false
h = nothing
try
h = hist(df)
hist(df["A"], df["B"], ymin = 0, ymax = 50)
hist(["1", "2", "3", "4", "5"], df["B"], ymin = 0, ymax = 50)
catch

end
@test ran
layers = [p[2] for p in layers(h)]
@test "A" in layers
@test "axes" in layers
end
@testset "scatter" begin
ran = false
h = nothing
try
scatter(df)
h = scatter(df["A"], df["B"], ymin = 0, ymax = 50, title = "sample")
catch

end
@test ran
layers = [p[2] for p in layers(h)]
@test "points" in layers
@test length(h.window[:children]["points"][:children]) == length(df["A"])
@test "axes" in layers
end
@testset "line" begin
ran = false
h = nothing
try
line(df)
h = line(df["A"], df["B"], ymin = 0, ymax = 50, title = "sample")
line(["hi", "hello"], df["A"][1:2])
catch

end
@test ran
layers = [p[2] for p in layers(h)]
@test "points" in layers
@test length(h.window[:children]["points"][:children]) == length(df["A"])
@test "axes" in layers
end
end
end

0 comments on commit 16c600d

Please sign in to comment.