From 16c600d529f71c405eaa24b1c275b040bb9c7005 Mon Sep 17 00:00:00 2001 From: emmy <52672675+emmaccode@users.noreply.github.com> Date: Fri, 10 May 2024 00:12:57 -0600 Subject: [PATCH] init tests :) --- test/runtests.jl | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 test/runtests.jl diff --git a/test/runtests.jl b/test/runtests.jl new file mode 100644 index 0000000..9067ffd --- /dev/null +++ b/test/runtests.jl @@ -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 \ No newline at end of file