Skip to content

Commit

Permalink
Fix broken tests (display) in Julia v1.6 (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbenet authored Mar 31, 2021
1 parent 154abc3 commit a6cbeb6
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 22 deletions.
38 changes: 27 additions & 11 deletions test/TM1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -435,19 +435,27 @@ end
@testset "Display" begin
tm = TaylorModel1(2, x1, ii1)
use_show_default(true)
@test string(exp(tm)) == "TaylorModel1{Interval{Float64},Float64}" *
"(Taylor1{Interval{Float64}}(Interval{Float64}" *
"[Interval(2.718281828459045, 2.7182818284590455), Interval(2.718281828459045, 2.7182818284590455), " *
"Interval(1.3591409142295225, 1.3591409142295228)], 2), Interval(-0.05020487208677604, 0.06448109909211741), " *
"Interval(1.0, 1.0), Interval(0.5, 1.5))"
if VERSION < v"1.6"
@test string(exp(tm)) == "TaylorModel1{Interval{Float64},Float64}" *
"(Taylor1{Interval{Float64}}(Interval{Float64}" *
"[Interval(2.718281828459045, 2.7182818284590455), Interval(2.718281828459045, 2.7182818284590455), " *
"Interval(1.3591409142295225, 1.3591409142295228)], 2), Interval(-0.05020487208677604, 0.06448109909211741), " *
"Interval(1.0, 1.0), Interval(0.5, 1.5))"
else
@test string(exp(tm)) == "TaylorModel1{Interval{Float64}, Float64}" *
"(Taylor1{Interval{Float64}}(Interval{Float64}" *
"[Interval(2.718281828459045, 2.7182818284590455), Interval(2.718281828459045, 2.7182818284590455), " *
"Interval(1.3591409142295225, 1.3591409142295228)], 2), Interval(-0.05020487208677604, 0.06448109909211741), " *
"Interval(1.0, 1.0), Interval(0.5, 1.5))"
end
use_show_default(false)
@test string(tm^3) == " Interval(1.0, 1.0) + Interval(3.0, 3.0) t + " *
"Interval(3.0, 3.0) t² + Interval(-0.125, 0.125)"
@test string(exp(tm)) == " Interval(2.718281828459045, 2.7182818284590455) + " *
"Interval(2.718281828459045, 2.7182818284590455) t + " *
"Interval(1.3591409142295225, 1.3591409142295228) t² + " *
"Interval(-0.05020487208677604, 0.06448109909211741)"
end
end

@testset "Tests for bounders" begin
@testset "Tests for linear dominated bounder" begin
Expand Down Expand Up @@ -863,11 +871,19 @@ end
@testset "Display" begin
tm = RTaylorModel1(3, x1, ii1)
use_show_default(true)
@test string(exp(tm)) == "RTaylorModel1{Interval{Float64},Float64}" *
"(Taylor1{Interval{Float64}}(Interval{Float64}" *
"[Interval(2.718281828459045, 2.7182818284590455), Interval(2.718281828459045, 2.7182818284590455), " *
"Interval(1.3591409142295225, 1.3591409142295228), Interval(0.45304697140984085, 0.45304697140984096)], 3), " *
"Interval(0.10281598943126369, 0.1256036426541982), Interval(1.0, 1.0), Interval(0.5, 1.5))"
if VERSION < v"1.6"
@test string(exp(tm)) == "RTaylorModel1{Interval{Float64},Float64}" *
"(Taylor1{Interval{Float64}}(Interval{Float64}" *
"[Interval(2.718281828459045, 2.7182818284590455), Interval(2.718281828459045, 2.7182818284590455), " *
"Interval(1.3591409142295225, 1.3591409142295228), Interval(0.45304697140984085, 0.45304697140984096)], 3), " *
"Interval(0.10281598943126369, 0.1256036426541982), Interval(1.0, 1.0), Interval(0.5, 1.5))"
else
@test string(exp(tm)) == "RTaylorModel1{Interval{Float64}, Float64}" *
"(Taylor1{Interval{Float64}}(Interval{Float64}" *
"[Interval(2.718281828459045, 2.7182818284590455), Interval(2.718281828459045, 2.7182818284590455), " *
"Interval(1.3591409142295225, 1.3591409142295228), Interval(0.45304697140984085, 0.45304697140984096)], 3), " *
"Interval(0.10281598943126369, 0.1256036426541982), Interval(1.0, 1.0), Interval(0.5, 1.5))"
end
use_show_default(false)
@test string(tm^3) == " Interval(1.0, 1.0) + Interval(3.0, 3.0) t + " *
"Interval(3.0, 3.0) t² + Interval(1.0, 1.0) t³ + Interval(0.0, 0.0) t⁴"
Expand Down
36 changes: 25 additions & 11 deletions test/TMN.jl
Original file line number Diff line number Diff line change
Expand Up @@ -355,17 +355,31 @@ set_variables(Interval{Float64}, [:x, :y], order=_order_max)
xm = TaylorModelN(1, _order, b1, ib1)
ym = TaylorModelN(2, _order, b1, ib1)
use_show_default(true)
@test string(xm+ym) == "TaylorModelN{2,Interval{Float64},Float64}" *
"(TaylorN{Interval{Float64}}" *
"(HomogeneousPolynomial{Interval{Float64}}" *
"[HomogeneousPolynomial{Interval{Float64}}" *
"(Interval{Float64}[Interval(1.0, 1.0)], 0), " *
"HomogeneousPolynomial{Interval{Float64}}" *
"(Interval{Float64}[Interval(1.0, 1.0), Interval(1.0, 1.0)], 1), " *
"HomogeneousPolynomial{Interval{Float64}}" *
"(Interval{Float64}[Interval(0.0, 0.0), Interval(0.0, 0.0), " *
"Interval(0.0, 0.0)], 2)], 2), Interval(0.0, 0.0), IntervalBox(Interval(0.0, 0.0), " *
"Interval(1.0, 1.0)), IntervalBox(Interval(-0.5, 0.5), Interval(0.5, 1.5)))"
if VERSION < v"1.6"
@test string(xm+ym) == "TaylorModelN{2,Interval{Float64},Float64}" *
"(TaylorN{Interval{Float64}}" *
"(HomogeneousPolynomial{Interval{Float64}}" *
"[HomogeneousPolynomial{Interval{Float64}}" *
"(Interval{Float64}[Interval(1.0, 1.0)], 0), " *
"HomogeneousPolynomial{Interval{Float64}}" *
"(Interval{Float64}[Interval(1.0, 1.0), Interval(1.0, 1.0)], 1), " *
"HomogeneousPolynomial{Interval{Float64}}" *
"(Interval{Float64}[Interval(0.0, 0.0), Interval(0.0, 0.0), " *
"Interval(0.0, 0.0)], 2)], 2), Interval(0.0, 0.0), IntervalBox(Interval(0.0, 0.0), " *
"Interval(1.0, 1.0)), IntervalBox(Interval(-0.5, 0.5), Interval(0.5, 1.5)))"
else
@test string(xm+ym) == "TaylorModelN{2, Interval{Float64}, Float64}" *
"(TaylorN{Interval{Float64}}" *
"(HomogeneousPolynomial{Interval{Float64}}" *
"[HomogeneousPolynomial{Interval{Float64}}" *
"(Interval{Float64}[Interval(1.0, 1.0)], 0), " *
"HomogeneousPolynomial{Interval{Float64}}" *
"(Interval{Float64}[Interval(1.0, 1.0), Interval(1.0, 1.0)], 1), " *
"HomogeneousPolynomial{Interval{Float64}}" *
"(Interval{Float64}[Interval(0.0, 0.0), Interval(0.0, 0.0), " *
"Interval(0.0, 0.0)], 2)], 2), Interval(0.0, 0.0), IntervalBox(Interval(0.0, 0.0), " *
"Interval(1.0, 1.0)), IntervalBox(Interval(-0.5, 0.5), Interval(0.5, 1.5)))"
end
use_show_default(false)
@test string((xm+ym)^2) == " Interval(1.0, 1.0) + Interval(2.0, 2.0) x + " *
"Interval(2.0, 2.0) y + Interval(1.0, 1.0) x² + Interval(2.0, 2.0) x y + " *
Expand Down

0 comments on commit a6cbeb6

Please sign in to comment.