Skip to content

Commit 8b4de1f

Browse files
committed
Update to linspace changes in #18777
Make trunc, round, floor, ceil testing more precise
1 parent 9a5b9e0 commit 8b4de1f

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

test/runtests.jl

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -98,31 +98,32 @@ if VERSION < v"0.4.0-dev+1387"
9898
@test isdefined(Main, :AbstractString)
9999
end
100100

101-
if VERSION < v"0.6.0-"
102-
@test round(Int, 3//4) == 1
103-
@test round(Int, 1) == 1
104-
@test round(Int, 1.1) == 1
101+
@test round(Int, 3//4) == 1
102+
@test round(Int, 1) == 1
103+
@test round(Int, 1.1) == 1
104+
@test ceil(Int, 1) == 1
105+
@test ceil(Int, 1.1) == 2
106+
@test floor(Int, 1) == 1
107+
@test floor(Int, 1.1) == 1
108+
@test trunc(Int, 1) == 1
109+
@test trunc(Int, 1.1) == 1
110+
111+
if VERSION < v"0.6.0-dev.1825"
105112
@test round(Int, [1, 1]) == [1, 1]
106113
@test round(Int, [1.1, 1.1]) == [1, 1]
107114
@test round(Int, [1 1]) == [1 1]
108115
@test round(Int, [1.1 1.1]) == [1 1]
109116
@test round(Int, fill(1.1, 2, 3, 4)) == fill(1, 2, 3, 4)
110-
@test ceil(Int, 1) == 1
111-
@test ceil(Int, 1.1) == 2
112117
@test ceil(Int, [1, 1]) == [1, 1]
113118
@test ceil(Int, [1.1, 1.1]) == [2, 2]
114119
@test ceil(Int, [1 1]) == [1 1]
115120
@test ceil(Int, [1.1 1.1]) == [2 2]
116121
@test ceil(Int, fill(1.1, 2, 3, 4)) == fill(2, 2, 3, 4)
117-
@test floor(Int, 1) == 1
118-
@test floor(Int, 1.1) == 1
119122
@test floor(Int, [1, 1]) == [1, 1]
120123
@test floor(Int, [1.1, 1.1]) == [1, 1]
121124
@test floor(Int, [1 1]) == [1 1]
122125
@test floor(Int, [1.1 1.1]) == [1 1]
123126
@test floor(Int, fill(1.1, 2, 3, 4)) == fill(1, 2, 3, 4)
124-
@test trunc(Int, 1) == 1
125-
@test trunc(Int, 1.1) == 1
126127
@test trunc(Int, [1, 1]) == [1, 1]
127128
@test trunc(Int, [1.1, 1.1]) == [1, 1]
128129
@test trunc(Int, [1 1]) == [1 1]
@@ -577,9 +578,6 @@ for T = (Float32, Float64)
577578
@test [Compat.linspace(-u,-u,1);] == [-u]
578579
@test [Compat.linspace(-u,u,2);] == [-u,u]
579580
@test [Compat.linspace(-u,u,3);] == [-u,0,u]
580-
@test [Compat.linspace(-u,u,4);] == [-u,0,0,u]
581-
@test [Compat.linspace(-u,u,4);][2] === -z
582-
@test [Compat.linspace(-u,u,4);][3] === z
583581
@test first(Compat.linspace(-u,-u,0)) == -u
584582
@test last(Compat.linspace(-u,-u,0)) == -u
585583
@test first(Compat.linspace(u,-u,0)) == u
@@ -588,12 +586,8 @@ for T = (Float32, Float64)
588586
@test [Compat.linspace(u,u,1);] == [u]
589587
@test [Compat.linspace(u,-u,2);] == [u,-u]
590588
@test [Compat.linspace(u,-u,3);] == [u,0,-u]
591-
@test [Compat.linspace(u,-u,4);] == [u,0,0,-u]
592-
@test [Compat.linspace(u,-u,4);][2] === z
593-
@test [Compat.linspace(u,-u,4);][3] === -z
594589
v = [Compat.linspace(-u,u,12);]
595590
@test length(v) == 12
596-
@test issorted(v) && unique(v) == [-u,0,0,u]
597591
@test [-3u:u:3u;] == [Compat.linspace(-3u,3u,7);] == [-3:3;].*u
598592
@test [3u:-u:-3u;] == [Compat.linspace(3u,-3u,7);] == [3:-1:-3;].*u
599593
end
@@ -1336,8 +1330,10 @@ end
13361330
@test allunique([1, 2, 3])
13371331
@test !allunique([1, 2, 1])
13381332
@test allunique(1:3)
1339-
@test allunique(FloatRange(0.0, 0.0, 0.0, 1.0))
1340-
@test !allunique(FloatRange(0.0, 0.0, 2.0, 1.0))
1333+
if VERSION < v"0.6.0-dev.2390"
1334+
@test allunique(FloatRange(0.0, 0.0, 0.0, 1.0))
1335+
@test !allunique(FloatRange(0.0, 0.0, 2.0, 1.0))
1336+
end
13411337

13421338
# Add test for Base.view
13431339
let a = rand(10,10)

0 commit comments

Comments
 (0)