Skip to content

Commit

Permalink
tests for all aes operations added
Browse files Browse the repository at this point in the history
  • Loading branch information
rdboyes committed Apr 8, 2024
1 parent 60aeb97 commit 12c1377
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ set_theme!(theme_ggplot2())
# see files for tests

include("test_aes.jl")
include("test_aes_ops.jl")
include("test_geoms.jl")
include("test_labs.jl")
include("test_lims.jl")
154 changes: 154 additions & 0 deletions test/test_aes_ops.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
@testset verbose = true "aes operations" begin

@testset "addition" begin
t = ggplot(penguins) +
geom_point(aes(x = :bill_length_mm + 10, y = :bill_depth_mm + 20))

m = Makie.plot(
Makie.SpecApi.GridLayout(
Makie.SpecApi.Axis(
plots = [
Makie.PlotSpec(
:Scatter,
penguins.bill_length_mm .+ 10,
penguins.bill_depth_mm .+ 20)
]
)
)
)

@test plot_images_equal(t, m)

t = ggplot(penguins) +
geom_point(aes(x = :bill_length_mm + :bill_depth_mm, y = :bill_depth_mm))

m = Makie.plot(
Makie.SpecApi.GridLayout(
Makie.SpecApi.Axis(
plots = [
Makie.PlotSpec(
:Scatter,
penguins.bill_length_mm .+ penguins.bill_depth_mm,
penguins.bill_depth_mm)
]
)
)
)

@test plot_images_equal(t, m)
end

@testset "subtraction" begin
t = ggplot(penguins) +
geom_point(aes(x = :bill_length_mm - 10, y = :bill_depth_mm - 20))

m = Makie.plot(
Makie.SpecApi.GridLayout(
Makie.SpecApi.Axis(
plots = [
Makie.PlotSpec(
:Scatter,
penguins.bill_length_mm .- 10,
penguins.bill_depth_mm .- 20)
]
)
)
)

@test plot_images_equal(t, m)

t = ggplot(penguins) +
geom_point(aes(x = :bill_length_mm - :bill_depth_mm, y = :bill_depth_mm))

m = Makie.plot(
Makie.SpecApi.GridLayout(
Makie.SpecApi.Axis(
plots = [
Makie.PlotSpec(
:Scatter,
penguins.bill_length_mm .- penguins.bill_depth_mm,
penguins.bill_depth_mm)
]
)
)
)

@test plot_images_equal(t, m)
end

@testset "multiplication" begin
t = ggplot(penguins) +
geom_point(aes(x = :bill_length_mm * 10, y = :bill_depth_mm * 20))

m = Makie.plot(
Makie.SpecApi.GridLayout(
Makie.SpecApi.Axis(
plots = [
Makie.PlotSpec(
:Scatter,
penguins.bill_length_mm .* 10,
penguins.bill_depth_mm .* 20)
]
)
)
)

@test plot_images_equal(t, m)

t = ggplot(penguins) +
geom_point(aes(x = :bill_length_mm * :bill_depth_mm, y = :bill_depth_mm))

m = Makie.plot(
Makie.SpecApi.GridLayout(
Makie.SpecApi.Axis(
plots = [
Makie.PlotSpec(
:Scatter,
penguins.bill_length_mm .* penguins.bill_depth_mm,
penguins.bill_depth_mm)
]
)
)
)

@test plot_images_equal(t, m)
end

@testset "division" begin
t = ggplot(penguins) +
geom_point(aes(x = :bill_length_mm/10, y = :bill_depth_mm/20))

m = Makie.plot(
Makie.SpecApi.GridLayout(
Makie.SpecApi.Axis(
plots = [
Makie.PlotSpec(
:Scatter,
penguins.bill_length_mm ./ 10,
penguins.bill_depth_mm ./ 20)
]
)
)
)

@test plot_images_equal(t, m)

t = ggplot(penguins) +
geom_point(aes(x = :bill_length_mm / :bill_depth_mm, y = :bill_depth_mm))

m = Makie.plot(
Makie.SpecApi.GridLayout(
Makie.SpecApi.Axis(
plots = [
Makie.PlotSpec(
:Scatter,
penguins.bill_length_mm ./ penguins.bill_depth_mm,
penguins.bill_depth_mm)
]
)
)
)

@test plot_images_equal(t, m)
end
end

0 comments on commit 12c1377

Please sign in to comment.