From 3129671af12f79ad223b8d431dd023615ff77cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlio=20Hoffimann?= Date: Wed, 6 Sep 2023 20:12:14 -0300 Subject: [PATCH] Update tests --- Project.toml | 2 +- test/runtests.jl | 235 +++++++++++++++++++++-------------------------- 2 files changed, 108 insertions(+), 129 deletions(-) diff --git a/Project.toml b/Project.toml index b5fe6ef..98aefec 100644 --- a/Project.toml +++ b/Project.toml @@ -14,7 +14,7 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [compat] DataAPI = "1.15" -Meshes = "0.35" +Meshes = "0.35.3" PrettyTables = "2.2" ScientificTypes = "3.0" Tables = "1.10" diff --git a/test/runtests.jl b/test/runtests.jl index 6db637f..2f755c6 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -272,177 +272,156 @@ dummymeta(domain, table) = GeoTable(domain, Dict(paramdim(domain) => table)) gtb = georef((; a, b, c), pset) @test sprint(show, gtb) == "9×4 GeoTable over 9 PointSet{2,Float64}" - @test_broken sprint(show, MIME("text/plain"), gtb) == """ + @test sprint(show, MIME("text/plain"), gtb) == """ 9×4 GeoTable over 9 PointSet{2,Float64} - ┌─────────┬────────────┬─────────┬─────────────────┐ - │ a │ b │ c │ geometry │ - │ Count │ Continuous │ Textual │ Point2 │ - │ NoUnits │ NoUnits │ NoUnits │ │ - ├─────────┼────────────┼─────────┼─────────────────┤ - │ 0 │ 2.34 │ txt1 │ Point(1.0, 1.0) │ - │ 6 │ 7.5 │ txt2 │ Point(2.0, 2.0) │ - │ 6 │ 0.06 │ txt3 │ Point(3.0, 3.0) │ - │ 3 │ 1.29 │ txt4 │ Point(4.0, 4.0) │ - │ 9 │ 3.64 │ txt5 │ Point(5.0, 5.0) │ - │ 5 │ 8.05 │ txt6 │ Point(6.0, 6.0) │ - │ 2 │ 0.11 │ txt7 │ Point(7.0, 7.0) │ - │ 2 │ 0.64 │ txt8 │ Point(8.0, 8.0) │ - │ 8 │ 8.46 │ txt9 │ Point(9.0, 9.0) │ - └─────────┴────────────┴─────────┴─────────────────┘""" + ┌───────────┬────────────┬───────────┬────────────┐ + │ a │ b │ c │ geometry │ + │ Count │ Continuous │ Textual │ Point2 │ + │ [NoUnits] │ [NoUnits] │ [NoUnits] │ │ + ├───────────┼────────────┼───────────┼────────────┤ + │ 0 │ 2.34 │ txt1 │ (1.0, 1.0) │ + │ 6 │ 7.5 │ txt2 │ (2.0, 2.0) │ + │ 6 │ 0.06 │ txt3 │ (3.0, 3.0) │ + │ 3 │ 1.29 │ txt4 │ (4.0, 4.0) │ + │ 9 │ 3.64 │ txt5 │ (5.0, 5.0) │ + │ 5 │ 8.05 │ txt6 │ (6.0, 6.0) │ + │ 2 │ 0.11 │ txt7 │ (7.0, 7.0) │ + │ 2 │ 0.64 │ txt8 │ (8.0, 8.0) │ + │ 8 │ 8.46 │ txt9 │ (9.0, 9.0) │ + └───────────┴────────────┴───────────┴────────────┘""" vgtb = view(gtb, 1:3) @test sprint(show, vgtb) == "3×4 GeoTableView over 3 View{9 PointSet{2,Float64}}" - @test_broken sprint(show, MIME("text/plain"), vgtb) == """ + @test sprint(show, MIME("text/plain"), vgtb) == """ 3×4 GeoTableView over 3 View{9 PointSet{2,Float64}} - ┌─────────┬────────────┬─────────┬─────────────────┐ - │ a │ b │ c │ geometry │ - │ Count │ Continuous │ Textual │ Point2 │ - │ NoUnits │ NoUnits │ NoUnits │ │ - ├─────────┼────────────┼─────────┼─────────────────┤ - │ 0 │ 2.34 │ txt1 │ Point(1.0, 1.0) │ - │ 6 │ 7.5 │ txt2 │ Point(2.0, 2.0) │ - │ 6 │ 0.06 │ txt3 │ Point(3.0, 3.0) │ - └─────────┴────────────┴─────────┴─────────────────┘""" + ┌───────────┬────────────┬───────────┬────────────┐ + │ a │ b │ c │ geometry │ + │ Count │ Continuous │ Textual │ Point2 │ + │ [NoUnits] │ [NoUnits] │ [NoUnits] │ │ + ├───────────┼────────────┼───────────┼────────────┤ + │ 0 │ 2.34 │ txt1 │ (1.0, 1.0) │ + │ 6 │ 7.5 │ txt2 │ (2.0, 2.0) │ + │ 6 │ 0.06 │ txt3 │ (3.0, 3.0) │ + └───────────┴────────────┴───────────┴────────────┘""" gtb = georef((a=a * u"m/s", b=b * u"km/hr", c=c), pset) @test sprint(show, gtb) == "9×4 GeoTable over 9 PointSet{2,Float64}" - @test_broken sprint(show, MIME("text/plain"), gtb) == """ + @test sprint(show, MIME("text/plain"), gtb) == """ 9×4 GeoTable over 9 PointSet{2,Float64} - ┌────────────┬───────────────┬─────────┬─────────────────┐ - │ a │ b │ c │ geometry │ - │ Continuous │ Continuous │ Textual │ Point2 │ - │ m s^-1 │ km hr^-1 │ NoUnits │ │ - ├────────────┼───────────────┼─────────┼─────────────────┤ - │ 0 m s^-1 │ 2.34 km hr^-1 │ txt1 │ Point(1.0, 1.0) │ - │ 6 m s^-1 │ 7.5 km hr^-1 │ txt2 │ Point(2.0, 2.0) │ - │ 6 m s^-1 │ 0.06 km hr^-1 │ txt3 │ Point(3.0, 3.0) │ - │ 3 m s^-1 │ 1.29 km hr^-1 │ txt4 │ Point(4.0, 4.0) │ - │ 9 m s^-1 │ 3.64 km hr^-1 │ txt5 │ Point(5.0, 5.0) │ - │ 5 m s^-1 │ 8.05 km hr^-1 │ txt6 │ Point(6.0, 6.0) │ - │ 2 m s^-1 │ 0.11 km hr^-1 │ txt7 │ Point(7.0, 7.0) │ - │ 2 m s^-1 │ 0.64 km hr^-1 │ txt8 │ Point(8.0, 8.0) │ - │ 8 m s^-1 │ 8.46 km hr^-1 │ txt9 │ Point(9.0, 9.0) │ - └────────────┴───────────────┴─────────┴─────────────────┘""" - - nv = length(vertices(grid)) - gtb = GeoTable(grid, etable=(; a, b, c), vtable=(; d=rand(nv))) - @test sprint(show, gtb) == "9×4 GeoTable over 3×3 CartesianGrid{2,Float64}" - @test_broken sprint(show, MIME("text/plain"), gtb) == """ - 9×4 GeoTable over 3×3 CartesianGrid{2,Float64} - ┌─────────┬────────────┬─────────┬────────────────────────────────────────────────────────────────────────────────┐ - │ a │ b │ c │ geometry │ - │ Count │ Continuous │ Textual │ Quadrangle{2, Float64} │ - │ NoUnits │ NoUnits │ NoUnits │ │ - ├─────────┼────────────┼─────────┼────────────────────────────────────────────────────────────────────────────────┤ - │ 0 │ 2.34 │ txt1 │ Quadrangle(Point(0.0, 0.0), Point(1.0, 0.0), Point(1.0, 1.0), Point(0.0, 1.0)) │ - │ 6 │ 7.5 │ txt2 │ Quadrangle(Point(1.0, 0.0), Point(2.0, 0.0), Point(2.0, 1.0), Point(1.0, 1.0)) │ - │ 6 │ 0.06 │ txt3 │ Quadrangle(Point(2.0, 0.0), Point(3.0, 0.0), Point(3.0, 1.0), Point(2.0, 1.0)) │ - │ 3 │ 1.29 │ txt4 │ Quadrangle(Point(0.0, 1.0), Point(1.0, 1.0), Point(1.0, 2.0), Point(0.0, 2.0)) │ - │ 9 │ 3.64 │ txt5 │ Quadrangle(Point(1.0, 1.0), Point(2.0, 1.0), Point(2.0, 2.0), Point(1.0, 2.0)) │ - │ 5 │ 8.05 │ txt6 │ Quadrangle(Point(2.0, 1.0), Point(3.0, 1.0), Point(3.0, 2.0), Point(2.0, 2.0)) │ - │ 2 │ 0.11 │ txt7 │ Quadrangle(Point(0.0, 2.0), Point(1.0, 2.0), Point(1.0, 3.0), Point(0.0, 3.0)) │ - │ 2 │ 0.64 │ txt8 │ Quadrangle(Point(1.0, 2.0), Point(2.0, 2.0), Point(2.0, 3.0), Point(1.0, 3.0)) │ - │ 8 │ 8.46 │ txt9 │ Quadrangle(Point(2.0, 2.0), Point(3.0, 2.0), Point(3.0, 3.0), Point(2.0, 3.0)) │ - └─────────┴────────────┴─────────┴────────────────────────────────────────────────────────────────────────────────┘""" + ┌────────────┬───────────────┬───────────┬────────────┐ + │ a │ b │ c │ geometry │ + │ Continuous │ Continuous │ Textual │ Point2 │ + │ [m s^-1] │ [km hr^-1] │ [NoUnits] │ │ + ├────────────┼───────────────┼───────────┼────────────┤ + │ 0 m s^-1 │ 2.34 km hr^-1 │ txt1 │ (1.0, 1.0) │ + │ 6 m s^-1 │ 7.5 km hr^-1 │ txt2 │ (2.0, 2.0) │ + │ 6 m s^-1 │ 0.06 km hr^-1 │ txt3 │ (3.0, 3.0) │ + │ 3 m s^-1 │ 1.29 km hr^-1 │ txt4 │ (4.0, 4.0) │ + │ 9 m s^-1 │ 3.64 km hr^-1 │ txt5 │ (5.0, 5.0) │ + │ 5 m s^-1 │ 8.05 km hr^-1 │ txt6 │ (6.0, 6.0) │ + │ 2 m s^-1 │ 0.11 km hr^-1 │ txt7 │ (7.0, 7.0) │ + │ 2 m s^-1 │ 0.64 km hr^-1 │ txt8 │ (8.0, 8.0) │ + │ 8 m s^-1 │ 8.46 km hr^-1 │ txt9 │ (9.0, 9.0) │ + └────────────┴───────────────┴───────────┴────────────┘""" gtb = georef((a=[missing; a[2:9]], b=[b[1:4]; missing; b[6:9]], c=[c[1:8]; missing]), pset) @test sprint(show, gtb) == "9×4 GeoTable over 9 PointSet{2,Float64}" - @test_broken sprint(show, MIME("text/plain"), gtb) == """ + @test sprint(show, MIME("text/plain"), gtb) == """ 9×4 GeoTable over 9 PointSet{2,Float64} - ┌─────────┬────────────┬─────────┬─────────────────┐ - │ a │ b │ c │ geometry │ - │ Count │ Continuous │ Textual │ Point2 │ - │ NoUnits │ NoUnits │ NoUnits │ │ - ├─────────┼────────────┼─────────┼─────────────────┤ - │ missing │ 2.34 │ txt1 │ Point(1.0, 1.0) │ - │ 6 │ 7.5 │ txt2 │ Point(2.0, 2.0) │ - │ 6 │ 0.06 │ txt3 │ Point(3.0, 3.0) │ - │ 3 │ 1.29 │ txt4 │ Point(4.0, 4.0) │ - │ 9 │ missing │ txt5 │ Point(5.0, 5.0) │ - │ 5 │ 8.05 │ txt6 │ Point(6.0, 6.0) │ - │ 2 │ 0.11 │ txt7 │ Point(7.0, 7.0) │ - │ 2 │ 0.64 │ txt8 │ Point(8.0, 8.0) │ - │ 8 │ 8.46 │ missing │ Point(9.0, 9.0) │ - └─────────┴────────────┴─────────┴─────────────────┘""" + ┌───────────┬────────────┬───────────┬────────────┐ + │ a │ b │ c │ geometry │ + │ Count │ Continuous │ Textual │ Point2 │ + │ [NoUnits] │ [NoUnits] │ [NoUnits] │ │ + ├───────────┼────────────┼───────────┼────────────┤ + │ missing │ 2.34 │ txt1 │ (1.0, 1.0) │ + │ 6 │ 7.5 │ txt2 │ (2.0, 2.0) │ + │ 6 │ 0.06 │ txt3 │ (3.0, 3.0) │ + │ 3 │ 1.29 │ txt4 │ (4.0, 4.0) │ + │ 9 │ missing │ txt5 │ (5.0, 5.0) │ + │ 5 │ 8.05 │ txt6 │ (6.0, 6.0) │ + │ 2 │ 0.11 │ txt7 │ (7.0, 7.0) │ + │ 2 │ 0.64 │ txt8 │ (8.0, 8.0) │ + │ 8 │ 8.46 │ missing │ (9.0, 9.0) │ + └───────────┴────────────┴───────────┴────────────┘""" gtb = georef((; a, b, c), pset) - @test_broken sprint(show, MIME("text/html"), gtb) == """ + @test sprint(show, MIME("text/html"), gtb) == """ - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + +
9×4 GeoTable over 9 PointSet{2,Float64}
abcgeometryabcgeometry
CountContinuousTextualPoint2CountContinuousTextualPoint2
NoUnitsNoUnitsNoUnits[NoUnits][NoUnits][NoUnits]
02.34txt1Point(1.0, 1.0)02.34txt1(1.0, 1.0)
67.5txt2Point(2.0, 2.0)67.5txt2(2.0, 2.0)
60.06txt3Point(3.0, 3.0)60.06txt3(3.0, 3.0)
31.29txt4Point(4.0, 4.0)31.29txt4(4.0, 4.0)
93.64txt5Point(5.0, 5.0)93.64txt5(5.0, 5.0)
58.05txt6Point(6.0, 6.0)58.05txt6(6.0, 6.0)
20.11txt7Point(7.0, 7.0)20.11txt7(7.0, 7.0)
20.64txt8Point(8.0, 8.0)20.64txt8(8.0, 8.0)
88.46txt9Point(9.0, 9.0)88.46txt9(9.0, 9.0)