-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathruntests.jl
142 lines (123 loc) · 3.72 KB
/
runtests.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
using ImageInTerminal, FreeType, FileIO, IntervalSets, Unitful, Term # weak deps, or @require
using UnicodePlots, Test
import UnicodePlots: lines!, points!, pixel!, nrows, ncols
import UnicodePlots: print_row, preprocess!, addrow!
import Dates: DateTime, Date, Day
import DataFrames: DataFrame
import Random: seed!
import ColorSchemes
import FileIO
import Aqua
import Pkg
using ReferenceTests
using LinearAlgebra
using TimerOutputs
using TestImages
using ColorTypes
using StableRNGs
using StatsBase
using Crayons
using Unitful
Pkg.status(; outdated = true, mode = Pkg.PKGMODE_MANIFEST)
include("fixes.jl")
const TO = TimerOutput()
const RNG = StableRNG(1_337)
const T_SZ = (24, 80) # default terminal size on unix
# see JuliaTesting/ReferenceTests.jl/pull/91
test_ref(reference, actual) = @test_reference(
joinpath("references_$(UnicodePlots.colormode())", reference),
actual,
render = ReferenceTests.BeforeAfterFull(),
format = "TXT"
)
is_ci() = Base.get_bool_env("CI", false)
is_pkgeval() = Base.get_bool_env("JULIA_PKGEVAL", false)
# helpers
"a plot must be square"
macro check_padding(x)
tmp = gensym()
quote
$tmp = UnicodePlots.no_ansi_escape($x)
if length.(split($tmp, '\n')) |> unique |> length == 1
@test true
else
println($x)
@test false
end
end |> esc
end
macro show_col(p, kv...)
tmp = gensym()
quote
$tmp = @io2str $(:(show(IOContext(::IO, :color => true, $(kv...)), $p)))
@check_padding $tmp
$tmp
end |> esc
end
macro show_nocol(p, kv...)
tmp = gensym()
quote
$tmp = @io2str $(:(show(IOContext(::IO, :color => false, $(kv...)), $p)))
@check_padding $tmp
$tmp
end |> esc
end
macro print_col(p, kv...)
tmp = gensym()
quote
$tmp = @io2str $(:(print(IOContext(::IO, :color => true, $(kv...)), $p)))
@check_padding $tmp
$tmp
end |> esc
end
macro print_nocol(p, kv...)
tmp = gensym()
quote
$tmp = @io2str $(:(print(IOContext(::IO, :color => false, $(kv...)), $p)))
@check_padding $tmp
$tmp
end |> esc
end
# return type Plot{BrailleCanvas{typeof(identity), typeof(identity)}} does not match
# inferred return type Plot{var"#s129"} where var"#s129"<:Canvas
const ID = typeof(identity)
macro binf(ex)
:(@inferred(Plot{BrailleCanvas{ID,ID}}, $ex)) |> esc
end
macro hinf(ex)
:(@inferred(Plot{HeatmapCanvas{ID,ID}}, $ex)) |> esc
end
macro timeit_include(path::AbstractString)
:(@timeit TO $path @testset $path begin
include($path)
end) |> esc
end
println("\n== start: testing with $(UnicodePlots.colormode())bit colormode ==\n")
withenv("FORCE_COLOR" => "X") do # JuliaPlots/UnicodePlots.jl/issues/134
@timeit_include "tst_freetype.jl"
@timeit_include "tst_depwarn.jl"
@timeit_include "tst_issues.jl"
@timeit_include "tst_io.jl"
@timeit_include "tst_common.jl"
@timeit_include "tst_graphics.jl"
@timeit_include "tst_canvas.jl"
@timeit_include "tst_plot.jl"
@timeit_include "tst_scatterplot.jl"
@timeit_include "tst_lineplot.jl"
@timeit_include "tst_densityplot.jl"
@timeit_include "tst_histogram.jl"
@timeit_include "tst_barplot.jl"
@timeit_include "tst_spy.jl"
@timeit_include "tst_boxplot.jl"
@timeit_include "tst_contourplot.jl"
@timeit_include "tst_polarplot.jl"
@timeit_include "tst_heatmap.jl"
@timeit_include "tst_volume.jl"
@timeit_include "tst_surfaceplot.jl"
@timeit_include "tst_isosurface.jl"
@timeit_include "tst_imageplot.jl"
@timeit_include "tst_quality.jl"
end
# ~ 94s & 9.88GiB on 1.11
print_timer(TO; compact = true, sortby = :firstexec)
println("\n== end: testing with $(UnicodePlots.colormode())bit colormode ==")