diff --git a/ext/TermExt.jl b/ext/TermExt.jl index 20d394ce..d8447be3 100644 --- a/ext/TermExt.jl +++ b/ext/TermExt.jl @@ -14,4 +14,4 @@ UnicodePlots.gridplot(plots::Union{AbstractVector,Tuple}; kw...) = UnicodePlots.gridplot(plots::Plot...; kw...) = Term.grid(map(UnicodePlots.panel, plots); kw...) -end +end # module diff --git a/src/interface/lineplot.jl b/src/interface/lineplot.jl index 91a8924f..4291c494 100644 --- a/src/interface/lineplot.jl +++ b/src/interface/lineplot.jl @@ -1,4 +1,6 @@ """ + lineplot(; kw...) + lineplot(y; kw...) lineplot(x, y; kw...) lineplot!(p, args...; kw...) @@ -75,6 +77,7 @@ function lineplot( lineplot!(Plot(x, y, z, canvas; pkw...), x, y, z; okw...) end +lineplot(; kw...) = lineplot([]; kw...) lineplot(y::AbstractVector; kw...) = lineplot(axes(y, 1), y; kw...) @doc (@doc lineplot) function lineplot!( diff --git a/src/interface/scatterplot.jl b/src/interface/scatterplot.jl index 03ab6286..dc264032 100644 --- a/src/interface/scatterplot.jl +++ b/src/interface/scatterplot.jl @@ -1,4 +1,6 @@ """ + scatterplot(; kw...) + scatterplot(y; kw...) scatterplot(x, y; kw...) scatterplot!(p, args...; kw...) @@ -69,6 +71,7 @@ function scatterplot( scatterplot!(Plot(x, y, z, canvas; pkw...), x, y, z; okw...) end +scatterplot(; kw...) = lineplot([]; kw...) scatterplot(y::AbstractVector; kw...) = scatterplot(axes(y, 1), y; kw...) @doc (@doc scatterplot) function scatterplot!( diff --git a/src/plot.jl b/src/plot.jl index c9e02333..04ef5476 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -149,6 +149,8 @@ function validate_input(x::AbstractVector, y::AbstractVector, z::Nothing) end end +Plot(; kw...) = Plot([], []; kw...) + function Plot( x::AbstractVector, y::AbstractVector, diff --git a/test/references_24/surfaceplot/sombrero_aspect.txt b/test/references_24/surfaceplot/sombrero_aspect.txt index 4e817124..06d21b57 100644 --- a/test/references_24/surfaceplot/sombrero_aspect.txt +++ b/test/references_24/surfaceplot/sombrero_aspect.txt @@ -11,7 +11,7 @@ │⠀⠀⠀⠀⠀⣠⣾⡿⠿⣿⣿⣕⣒⣒⣊⣽⣯⡮⠵⠅⠮⠮⢵⣽⣯⣑⣒⣒⣪⣿⣿⠿⢿⣷⣄⠀⠀⠀⠀⠀│ │▄▄│ │⠀⠀⠀⠐⠻⠿⠛⠛⠛⠛⠽⢿⣶⣶⡾⠓⠉⠢⠈⡀⢁⠁⠔⠉⠚⢷⣶⣶⡿⠯⠛⠛⠛⠛⠿⠟⠂⠀⠀⠀│ │▄▄│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⣯⣯⣓⢶⣷⡆⣶⣾⡶⣚⣽⣽⠿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⡳⡻⡃⢟⢟⢞⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠀⢀⡠⠼⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠪⠆⡵⠕⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠊⠁⠀⠀⠀⠀⠉⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⡳⡻⡃⢟⢟⢞⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠪⠆⡵⠕⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘ └────────────────────────────────────────┘ -10 \ No newline at end of file diff --git a/test/references_24/surfaceplot/sombrero_identity.txt b/test/references_24/surfaceplot/sombrero_identity.txt index 8b7bbf85..247c563a 100644 --- a/test/references_24/surfaceplot/sombrero_identity.txt +++ b/test/references_24/surfaceplot/sombrero_identity.txt @@ -10,8 +10,8 @@ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣨⣅⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⡾⢟⣿⣿⣿⣿⡻⢷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⡿⣿⣋⣿⣿⣿⣿⣙⣿⢿⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠟⠀⢿⣟⣿⣟⣿⣿⣻⡿⠀⠻⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⢸⣿⣿⢿⡿⣿⣿⡇⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠀⢀⡠⠜⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⠮⣿⣿⠵⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠊⠁⠀⠀⠀⠀⠉⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠟⠀⢿⣟⣿⣟⣿⣿⣻⡿⠀⠻⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⢸⣿⣿⢿⡿⣿⣿⡇⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⠮⣿⣿⠵⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘ └────────────────────────────────────────┘ -10 \ No newline at end of file diff --git a/test/references_24/surfaceplot/sombrero_zscale.txt b/test/references_24/surfaceplot/sombrero_zscale.txt index 5ffbe508..6e5d084a 100644 --- a/test/references_24/surfaceplot/sombrero_zscale.txt +++ b/test/references_24/surfaceplot/sombrero_zscale.txt @@ -11,7 +11,7 @@ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⢖⡒⢊⡠⣯⣳⠳⠟⣞⣽⢄⡑⢒⡲⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡿⡿⢿⣷⣏⣉⢤⣣⣺⡭⢯⣗⣜⡤⣉⣹⣾⡿⢿⢿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ │⠀⠀⠀⠀⠀⠀⠀⠀⠺⠟⠉⠀⠀⠈⣿⣻⣿⡷⢿⡻⣟⡿⢾⣿⣟⣿⠁⠀⠀⠉⠻⠗⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣯⣟⣻⢞⡷⣟⣻⣽⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠀⢀⡠⠼⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⣺⣗⠟⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠊⠁⠀⠀⠀⠀⠉⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣯⣟⣻⢞⡷⣟⣻⣽⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⣺⣗⠟⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘ └────────────────────────────────────────┘ -10 \ No newline at end of file diff --git a/test/references_8/surfaceplot/sombrero_aspect.txt b/test/references_8/surfaceplot/sombrero_aspect.txt index ae680fa9..d81e1ad5 100644 --- a/test/references_8/surfaceplot/sombrero_aspect.txt +++ b/test/references_8/surfaceplot/sombrero_aspect.txt @@ -11,7 +11,7 @@ │⠀⠀⠀⠀⠀⣠⣾⡿⠿⣿⣿⣕⣒⣒⣊⣽⣯⡮⠵⠅⠮⠮⢵⣽⣯⣑⣒⣒⣪⣿⣿⠿⢿⣷⣄⠀⠀⠀⠀⠀│ │▄▄│ │⠀⠀⠀⠐⠻⠿⠛⠛⠛⠛⠽⢿⣶⣶⡾⠓⠉⠢⠈⡀⢁⠁⠔⠉⠚⢷⣶⣶⡿⠯⠛⠛⠛⠛⠿⠟⠂⠀⠀⠀│ │▄▄│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⣯⣯⣓⢶⣷⡆⣶⣾⡶⣚⣽⣽⠿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⡳⡻⡃⢟⢟⢞⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠀⢀⡠⠼⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠪⠆⡵⠕⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠊⠁⠀⠀⠀⠀⠉⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⡳⡻⡃⢟⢟⢞⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠪⠆⡵⠕⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘ └────────────────────────────────────────┘ -10 \ No newline at end of file diff --git a/test/references_8/surfaceplot/sombrero_identity.txt b/test/references_8/surfaceplot/sombrero_identity.txt index 426fca2d..b44eb568 100644 --- a/test/references_8/surfaceplot/sombrero_identity.txt +++ b/test/references_8/surfaceplot/sombrero_identity.txt @@ -10,8 +10,8 @@ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣨⣅⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⡾⢟⣿⣿⣿⣿⡻⢷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⡿⣿⣋⣿⣿⣿⣿⣙⣿⢿⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠟⠀⢿⣟⣿⣟⣿⣿⣻⡿⠀⠻⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⢸⣿⣿⢿⡿⣿⣿⡇⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠀⢀⡠⠜⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⠮⣿⣿⠵⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠊⠁⠀⠀⠀⠀⠉⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠟⠀⢿⣟⣿⣟⣿⣿⣻⡿⠀⠻⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⢸⣿⣿⢿⡿⣿⣿⡇⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⠮⣿⣿⠵⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘ └────────────────────────────────────────┘ -10 \ No newline at end of file diff --git a/test/references_8/surfaceplot/sombrero_zscale.txt b/test/references_8/surfaceplot/sombrero_zscale.txt index 85d4a596..bf97dc5f 100644 --- a/test/references_8/surfaceplot/sombrero_zscale.txt +++ b/test/references_8/surfaceplot/sombrero_zscale.txt @@ -11,7 +11,7 @@ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⢖⡒⢊⡠⣯⣳⠳⠟⣞⣽⢄⡑⢒⡲⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ │⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡿⡿⢿⣷⣏⣉⢤⣣⣺⡭⢯⣗⣜⡤⣉⣹⣾⡿⢿⢿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ │⠀⠀⠀⠀⠀⠀⠀⠀⠺⠟⠉⠀⠀⠈⣿⣻⣿⡷⢿⡻⣟⡿⢾⣿⣟⣿⠁⠀⠀⠉⠻⠗⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣯⣟⣻⢞⡷⣟⣻⣽⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠀⢀⡠⠼⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⣺⣗⠟⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ - │⠊⠁⠀⠀⠀⠀⠉⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣯⣟⣻⢞⡷⣟⣻⣽⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⣺⣗⠟⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│ + │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘ └────────────────────────────────────────┘ -10 \ No newline at end of file diff --git a/test/runtests.jl b/test/runtests.jl index 565bab2e..f3d14c3c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -132,7 +132,7 @@ withenv("FORCE_COLOR" => "X") do # JuliaPlots/UnicodePlots.jl/issues/134 @timeit_include "tst_quality.jl" end -# ~ 193s & 12.3GiB on 1.8 +# ~ 90s & 8.26GiB on 1.9 print_timer(TO; compact = true, sortby = :firstexec) println("\n== end: testing with $(UnicodePlots.colormode())bit colormode ==") diff --git a/test/tst_io.jl b/test/tst_io.jl index 54766293..414ada2f 100644 --- a/test/tst_io.jl +++ b/test/tst_io.jl @@ -60,11 +60,13 @@ end p = heatmap(collect(1:30) * collect(1:30)') @test string(p; color = true) isa String # 1st pass - ttfp - if Sys.islinux() + measure = Sys.islinux() && VERSION > v"1.9.0" && length(VERSION.prerelease) < 2 + + if measure GC.enable(false) stats = @timed string(p; color = true) # repeated ! - @test stats.bytes / 1e3 < 600 # ~ 550kB on 1.7 - @test stats.time * 1e3 < 2 # ~ 1.17ms on 1.7 + @test stats.bytes / 1e3 < 400 # ~ 374kB on 1.9 + @test stats.time * 1e3 < 1 # ~ 0.3ms on 1.9 GC.enable(true) end @@ -72,11 +74,11 @@ end p = surfaceplot(-8:0.5:8, -8:0.5:8, sombrero; axes3d = false) @test string(p; color = true) isa String # 1st pass - ttfp - if Sys.islinux() + if measure GC.enable(false) stats = @timed string(p; color = true) # repeated ! - @test stats.bytes / 1e3 < 250 # ~ 155kB on 1.7 - @test stats.time * 1e3 < 1 # ~ 0.42ms on 1.7 + @test stats.bytes / 1e3 < 160 # ~ 152kB on 1.9 + @test stats.time * 1e3 < 0.5 # ~ 0.16ms on 1.9 GC.enable(true) end end diff --git a/test/tst_lineplot.jl b/test/tst_lineplot.jl index ac04a243..eeab7107 100644 --- a/test/tst_lineplot.jl +++ b/test/tst_lineplot.jl @@ -1,16 +1,18 @@ x = [-1, 1, 3, 3, -1] y = [2, 0, -5, 2, -5] -@test_throws MethodError lineplot() -@test_throws MethodError lineplot(sin, x, y) -@test_throws ArgumentError lineplot(0, 3, Function[]) -@test_throws ArgumentError lineplot(x, Function[]) -@test_throws ArgumentError lineplot(Function[]) -@test_throws Union{BoundsError,DimensionMismatch} lineplot([1, 2], [1, 2, 3]) -@test_throws Union{BoundsError,DimensionMismatch} lineplot([1, 2, 3], [1, 2]) -@test_throws Union{BoundsError,DimensionMismatch} lineplot([1, 2, 3], 1:2) -@test_throws Union{BoundsError,DimensionMismatch} lineplot(1:3, [1, 2]) -@test_throws Union{BoundsError,DimensionMismatch} lineplot(1:3, 1:2) +@testset "input" begin + @test lineplot() isa Plot + @test_throws MethodError lineplot(sin, x, y) + @test_throws ArgumentError lineplot(0, 3, Function[]) + @test_throws ArgumentError lineplot(x, Function[]) + @test_throws ArgumentError lineplot(Function[]) + @test_throws Union{BoundsError,DimensionMismatch} lineplot([1, 2], [1, 2, 3]) + @test_throws Union{BoundsError,DimensionMismatch} lineplot([1, 2, 3], [1, 2]) + @test_throws Union{BoundsError,DimensionMismatch} lineplot([1, 2, 3], 1:2) + @test_throws Union{BoundsError,DimensionMismatch} lineplot(1:3, [1, 2]) + @test_throws Union{BoundsError,DimensionMismatch} lineplot(1:3, 1:2) +end @testset "Nan / Inf" begin @test lineplot([0, NaN], [0, 0]) isa Plot diff --git a/test/tst_plot.jl b/test/tst_plot.jl index 3adca9b9..df607734 100644 --- a/test/tst_plot.jl +++ b/test/tst_plot.jl @@ -10,6 +10,8 @@ test_ref("plot/empty_small.txt", @show_col(p)) # empty plot ctor + p = Plot() + @test p isa Plot p = Plot([], []) @test p isa Plot p = Plot([], [], []) diff --git a/test/tst_scatterplot.jl b/test/tst_scatterplot.jl index adf5aedc..25be4b94 100644 --- a/test/tst_scatterplot.jl +++ b/test/tst_scatterplot.jl @@ -1,14 +1,16 @@ x = [-1, 1, 3, 3, -1] y = [2, 0, -5, 2, -5] -@test_throws MethodError scatterplot() -@test_throws MethodError scatterplot(sin, x) -@test_throws DimensionMismatch scatterplot([sin], x) -@test_throws DimensionMismatch scatterplot([1, 2], [1, 2, 3]) -@test_throws DimensionMismatch scatterplot([1, 2, 3], [1, 2]) -@test_throws DimensionMismatch scatterplot([1, 2, 3], 1:2) -@test_throws DimensionMismatch scatterplot(1:3, [1, 2]) -@test_throws DimensionMismatch scatterplot(1:3, 1:2) +@testset "input" begin + @test scatterplot() isa Plot + @test_throws MethodError scatterplot(sin, x) + @test_throws DimensionMismatch scatterplot([sin], x) + @test_throws DimensionMismatch scatterplot([1, 2], [1, 2, 3]) + @test_throws DimensionMismatch scatterplot([1, 2, 3], [1, 2]) + @test_throws DimensionMismatch scatterplot([1, 2, 3], 1:2) + @test_throws DimensionMismatch scatterplot(1:3, [1, 2]) + @test_throws DimensionMismatch scatterplot(1:3, 1:2) +end @testset "boundaries" begin # tests that the two points are drawn correctly on the canvas diff --git a/test/tst_surfaceplot.jl b/test/tst_surfaceplot.jl index d0b6855e..e7ca9c85 100644 --- a/test/tst_surfaceplot.jl +++ b/test/tst_surfaceplot.jl @@ -3,13 +3,13 @@ @testset "zscale" begin sombrero(x, y) = 50sinc(√(x^2 + y^2) / π) - p = surfaceplot(-8:0.5:8, -8:0.5:8, sombrero) + p = surfaceplot(-8:0.5:8, -8:0.5:8, sombrero; axes3d = false) test_ref("surfaceplot/sombrero_aspect.txt", @show_col(p)) - p = surfaceplot(-8:0.5:8, -8:0.5:8, sombrero; zscale = :identity) + p = surfaceplot(-8:0.5:8, -8:0.5:8, sombrero; axes3d = false, zscale = :identity) test_ref("surfaceplot/sombrero_identity.txt", @show_col(p)) - p = surfaceplot(-8:0.5:8, -8:0.5:8, sombrero; zscale = h -> h / 2) + p = surfaceplot(-8:0.5:8, -8:0.5:8, sombrero; axes3d = false, zscale = h -> h / 2) test_ref("surfaceplot/sombrero_zscale.txt", @show_col(p)) @test_throws ArgumentError surfaceplot([1 2; 3 4]; zscale = :not_supported)