@@ -101,32 +101,35 @@ end
101
101
@test round (Int, 3 // 4 ) == 1
102
102
@test round (Int, 1 ) == 1
103
103
@test round (Int, 1.1 ) == 1
104
- @test round (Int, [1 , 1 ]) == [1 , 1 ]
105
- @test round (Int, [1.1 , 1.1 ]) == [1 , 1 ]
106
- @test round (Int, [1 1 ]) == [1 1 ]
107
- @test round (Int, [1.1 1.1 ]) == [1 1 ]
108
- @test round (Int, fill (1.1 , 2 , 3 , 4 )) == fill (1 , 2 , 3 , 4 )
109
104
@test ceil (Int, 1 ) == 1
110
105
@test ceil (Int, 1.1 ) == 2
111
- @test ceil (Int, [1 , 1 ]) == [1 , 1 ]
112
- @test ceil (Int, [1.1 , 1.1 ]) == [2 , 2 ]
113
- @test ceil (Int, [1 1 ]) == [1 1 ]
114
- @test ceil (Int, [1.1 1.1 ]) == [2 2 ]
115
- @test ceil (Int, fill (1.1 , 2 , 3 , 4 )) == fill (2 , 2 , 3 , 4 )
116
106
@test floor (Int, 1 ) == 1
117
107
@test floor (Int, 1.1 ) == 1
118
- @test floor (Int, [1 , 1 ]) == [1 , 1 ]
119
- @test floor (Int, [1.1 , 1.1 ]) == [1 , 1 ]
120
- @test floor (Int, [1 1 ]) == [1 1 ]
121
- @test floor (Int, [1.1 1.1 ]) == [1 1 ]
122
- @test floor (Int, fill (1.1 , 2 , 3 , 4 )) == fill (1 , 2 , 3 , 4 )
123
108
@test trunc (Int, 1 ) == 1
124
109
@test trunc (Int, 1.1 ) == 1
125
- @test trunc (Int, [1 , 1 ]) == [1 , 1 ]
126
- @test trunc (Int, [1.1 , 1.1 ]) == [1 , 1 ]
127
- @test trunc (Int, [1 1 ]) == [1 1 ]
128
- @test trunc (Int, [1.1 1.1 ]) == [1 1 ]
129
- @test trunc (Int, fill (1.1 , 2 , 3 , 4 )) == fill (1 , 2 , 3 , 4 )
110
+
111
+ if VERSION < v " 0.6.0-dev.1825"
112
+ @test round (Int, [1 , 1 ]) == [1 , 1 ]
113
+ @test round (Int, [1.1 , 1.1 ]) == [1 , 1 ]
114
+ @test round (Int, [1 1 ]) == [1 1 ]
115
+ @test round (Int, [1.1 1.1 ]) == [1 1 ]
116
+ @test round (Int, fill (1.1 , 2 , 3 , 4 )) == fill (1 , 2 , 3 , 4 )
117
+ @test ceil (Int, [1 , 1 ]) == [1 , 1 ]
118
+ @test ceil (Int, [1.1 , 1.1 ]) == [2 , 2 ]
119
+ @test ceil (Int, [1 1 ]) == [1 1 ]
120
+ @test ceil (Int, [1.1 1.1 ]) == [2 2 ]
121
+ @test ceil (Int, fill (1.1 , 2 , 3 , 4 )) == fill (2 , 2 , 3 , 4 )
122
+ @test floor (Int, [1 , 1 ]) == [1 , 1 ]
123
+ @test floor (Int, [1.1 , 1.1 ]) == [1 , 1 ]
124
+ @test floor (Int, [1 1 ]) == [1 1 ]
125
+ @test floor (Int, [1.1 1.1 ]) == [1 1 ]
126
+ @test floor (Int, fill (1.1 , 2 , 3 , 4 )) == fill (1 , 2 , 3 , 4 )
127
+ @test trunc (Int, [1 , 1 ]) == [1 , 1 ]
128
+ @test trunc (Int, [1.1 , 1.1 ]) == [1 , 1 ]
129
+ @test trunc (Int, [1 1 ]) == [1 1 ]
130
+ @test trunc (Int, [1.1 1.1 ]) == [1 1 ]
131
+ @test trunc (Int, fill (1.1 , 2 , 3 , 4 )) == fill (1 , 2 , 3 , 4 )
132
+ end
130
133
131
134
# n % Type
132
135
for T in Any[Int16, Int32, UInt32, Int64, UInt64]
@@ -575,9 +578,6 @@ for T = (Float32, Float64)
575
578
@test [Compat. linspace (- u,- u,1 );] == [- u]
576
579
@test [Compat. linspace (- u,u,2 );] == [- u,u]
577
580
@test [Compat. linspace (- u,u,3 );] == [- u,0 ,u]
578
- @test [Compat. linspace (- u,u,4 );] == [- u,0 ,0 ,u]
579
- @test [Compat. linspace (- u,u,4 );][2 ] === - z
580
- @test [Compat. linspace (- u,u,4 );][3 ] === z
581
581
@test first (Compat. linspace (- u,- u,0 )) == - u
582
582
@test last (Compat. linspace (- u,- u,0 )) == - u
583
583
@test first (Compat. linspace (u,- u,0 )) == u
@@ -586,12 +586,8 @@ for T = (Float32, Float64)
586
586
@test [Compat. linspace (u,u,1 );] == [u]
587
587
@test [Compat. linspace (u,- u,2 );] == [u,- u]
588
588
@test [Compat. linspace (u,- u,3 );] == [u,0 ,- u]
589
- @test [Compat. linspace (u,- u,4 );] == [u,0 ,0 ,- u]
590
- @test [Compat. linspace (u,- u,4 );][2 ] === z
591
- @test [Compat. linspace (u,- u,4 );][3 ] === - z
592
589
v = [Compat. linspace (- u,u,12 );]
593
590
@test length (v) == 12
594
- @test issorted (v) && unique (v) == [- u,0 ,0 ,u]
595
591
@test [- 3 u: u: 3 u;] == [Compat. linspace (- 3 u,3 u,7 );] == [- 3 : 3 ;]. * u
596
592
@test [3 u: - u: - 3 u;] == [Compat. linspace (3 u,- 3 u,7 );] == [3 : - 1 : - 3 ;]. * u
597
593
end
@@ -981,29 +977,29 @@ cd(dirwalk) do
981
977
follow_symlink_vec = has_symlinks ? [true , false ] : [false ]
982
978
has_symlinks && symlink (abspath (" sub_dir2" ), joinpath (" sub_dir1" , " link" ))
983
979
for follow_symlinks in follow_symlink_vec
984
- task = walkdir (" ." , follow_symlinks= follow_symlinks)
985
- root, dirs, files = consume (task )
980
+ chnl = walkdir (" ." , follow_symlinks= follow_symlinks)
981
+ root, dirs, files = take! (chnl )
986
982
@test root == " ."
987
983
@test dirs == [" sub_dir1" , " sub_dir2" ]
988
984
@test files == [" file1" , " file2" ]
989
985
990
- root, dirs, files = consume (task )
986
+ root, dirs, files = take! (chnl )
991
987
@test root == joinpath (" ." , " sub_dir1" )
992
988
@test dirs == (has_symlinks ? [" link" , " subsub_dir1" , " subsub_dir2" ] : [" subsub_dir1" , " subsub_dir2" ])
993
989
@test files == [" file1" , " file2" ]
994
990
995
- root, dirs, files = consume (task )
991
+ root, dirs, files = take! (chnl )
996
992
if follow_symlinks
997
993
@test root == joinpath (" ." , " sub_dir1" , " link" )
998
994
@test dirs == []
999
995
@test files == [" file_dir2" ]
1000
- root, dirs, files = consume (task )
996
+ root, dirs, files = take! (chnl )
1001
997
end
1002
998
for i= 1 : 2
1003
999
@test root == joinpath (" ." , " sub_dir1" , " subsub_dir$i " )
1004
1000
@test dirs == []
1005
1001
@test files == []
1006
- root, dirs, files = consume (task )
1002
+ root, dirs, files = take! (chnl )
1007
1003
end
1008
1004
1009
1005
@test root == joinpath (" ." , " sub_dir2" )
@@ -1012,51 +1008,51 @@ cd(dirwalk) do
1012
1008
end
1013
1009
1014
1010
for follow_symlinks in follow_symlink_vec
1015
- task = walkdir (" ." , follow_symlinks= follow_symlinks, topdown= false )
1016
- root, dirs, files = consume (task )
1011
+ chnl = walkdir (" ." , follow_symlinks= follow_symlinks, topdown= false )
1012
+ root, dirs, files = take! (chnl )
1017
1013
if follow_symlinks
1018
1014
@test root == joinpath (" ." , " sub_dir1" , " link" )
1019
1015
@test dirs == []
1020
1016
@test files == [" file_dir2" ]
1021
- root, dirs, files = consume (task )
1017
+ root, dirs, files = take! (chnl )
1022
1018
end
1023
1019
for i= 1 : 2
1024
1020
@test root == joinpath (" ." , " sub_dir1" , " subsub_dir$i " )
1025
1021
@test dirs == []
1026
1022
@test files == []
1027
- root, dirs, files = consume (task )
1023
+ root, dirs, files = take! (chnl )
1028
1024
end
1029
1025
@test root == joinpath (" ." , " sub_dir1" )
1030
1026
@test dirs == (has_symlinks ? [" link" , " subsub_dir1" , " subsub_dir2" ] : [" subsub_dir1" , " subsub_dir2" ])
1031
1027
@test files == [" file1" , " file2" ]
1032
1028
1033
- root, dirs, files = consume (task )
1029
+ root, dirs, files = take! (chnl )
1034
1030
@test root == joinpath (" ." , " sub_dir2" )
1035
1031
@test dirs == []
1036
1032
@test files == [" file_dir2" ]
1037
1033
1038
- root, dirs, files = consume (task )
1034
+ root, dirs, files = take! (chnl )
1039
1035
@test root == " ."
1040
1036
@test dirs == [" sub_dir1" , " sub_dir2" ]
1041
1037
@test files == [" file1" , " file2" ]
1042
1038
end
1043
1039
# test of error handling
1044
- task_error = walkdir (" ." )
1045
- task_noerror = walkdir (" ." , onerror= x-> x)
1046
- root, dirs, files = consume (task_error )
1040
+ chnl_error = walkdir (" ." )
1041
+ chnl_noerror = walkdir (" ." , onerror= x-> x)
1042
+ root, dirs, files = take! (chnl_error )
1047
1043
@test root == " ."
1048
1044
@test dirs == [" sub_dir1" , " sub_dir2" ]
1049
1045
@test files == [" file1" , " file2" ]
1050
1046
1051
1047
rm (joinpath (" sub_dir1" ), recursive= true )
1052
- @test_throws SystemError consume (task_error ) # throws an error because sub_dir1 do not exist
1048
+ @test_throws SystemError take! (chnl_error ) # throws an error because sub_dir1 do not exist
1053
1049
1054
- root, dirs, files = consume (task_noerror )
1050
+ root, dirs, files = take! (chnl_noerror )
1055
1051
@test root == " ."
1056
1052
@test dirs == [" sub_dir1" , " sub_dir2" ]
1057
1053
@test files == [" file1" , " file2" ]
1058
1054
1059
- root, dirs, files = consume (task_noerror ) # skips sub_dir1 as it no longer exist
1055
+ root, dirs, files = take! (chnl_noerror ) # skips sub_dir1 as it no longer exist
1060
1056
@test root == joinpath (" ." , " sub_dir2" )
1061
1057
@test dirs == []
1062
1058
@test files == [" file_dir2" ]
@@ -1164,10 +1160,13 @@ end
1164
1160
let a = rand (1 : 10 , 10 )
1165
1161
@test mapreduce (identity, dot, a) == mapreduce (identity, @functorize (dot), a)
1166
1162
end
1167
- @test isa (@functorize (centralizedabs2fun)(1 ), @functorize (centralizedabs2fun))
1168
- @test isa (@functorize (centralizedabs2fun)(1.0 ), @functorize (centralizedabs2fun))
1169
- let a = rand (1 : 10 , 10 )
1170
- @eval @test mapreduce (x -> abs2 (x - 1 ), + , $ (a)) == mapreduce (@functorize (centralizedabs2fun)(1 ), + , $ (a))
1163
+
1164
+ if VERSION < v " 0.6.0-dev.2521"
1165
+ @test isa (@functorize (centralizedabs2fun)(1 ), @functorize (centralizedabs2fun))
1166
+ @test isa (@functorize (centralizedabs2fun)(1.0 ), @functorize (centralizedabs2fun))
1167
+ let a = rand (1 : 10 , 10 )
1168
+ @eval @test mapreduce (x -> abs2 (x - 1 ), + , $ (a)) == mapreduce (@functorize (centralizedabs2fun)(1 ), + , $ (a))
1169
+ end
1171
1170
end
1172
1171
1173
1172
# Threads.@threads
@@ -1190,7 +1189,7 @@ let x = rand(3), y = rand(3)
1190
1189
@test @compat (sin .(cos .(x))) == map (x -> sin (cos (x)), x)
1191
1190
@test @compat (atan2 .(sin .(y),x)) == broadcast (atan2,map (sin,y),x)
1192
1191
end
1193
- let x0 = Array ( Float64), v, v0
1192
+ let x0 = Array { Float64} ( ), v, v0
1194
1193
x0[1 ] = rand ()
1195
1194
v0 = @compat sin .(x0)
1196
1195
@test isa (v0, Array{Float64,0 })
@@ -1334,8 +1333,10 @@ end
1334
1333
@test allunique ([1 , 2 , 3 ])
1335
1334
@test ! allunique ([1 , 2 , 1 ])
1336
1335
@test allunique (1 : 3 )
1337
- @test allunique (FloatRange (0.0 , 0.0 , 0.0 , 1.0 ))
1338
- @test ! allunique (FloatRange (0.0 , 0.0 , 2.0 , 1.0 ))
1336
+ if VERSION < v " 0.6.0-dev.2390"
1337
+ @test allunique (FloatRange (0.0 , 0.0 , 0.0 , 1.0 ))
1338
+ @test ! allunique (FloatRange (0.0 , 0.0 , 2.0 , 1.0 ))
1339
+ end
1339
1340
1340
1341
# Add test for Base.view
1341
1342
let a = rand (10 ,10 )
0 commit comments