Skip to content

Commit 2f2c3bb

Browse files
committed
Test result eltype on *cat methods
1 parent 5102a7f commit 2f2c3bb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/basic.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,36 +225,42 @@ end
225225
return [x; x; x]
226226
end
227227
@test f(x_concrete) == ones(Bool, 3)
228+
@test eltype(f(x_concrete)) === Bool
228229

229230
# hcat
230231
f = Reactant.compile((x_concrete,)) do x
231232
return [x x x]
232233
end
233234
@test f(x_concrete) == ones(Bool, 1, 3)
235+
@test eltype(f(x_concrete)) === Bool
234236

235237
# hvcat
236238
f = Reactant.compile((x_concrete,)) do x
237239
return [x x x; x x x]
238240
end
239241
@test f(x_concrete) == ones(Bool, 2, 3)
242+
@test eltype(f(x_concrete)) === Bool
240243

241244
# typed_vcat
242245
f = Reactant.compile((x_concrete,)) do x
243246
return Int[x; x; x]
244247
end
245248
@test f(x_concrete) == ones(Int, 3)
249+
@test eltype(f(x_concrete)) === Int
246250

247251
# typed_hcat
248252
f = Reactant.compile((x_concrete,)) do x
249253
return Int[x; x; x]
250254
end
251255
@test f(x_concrete) == ones(Int, 1, 3)
256+
@test eltype(f(x_concrete)) === Int
252257

253258
# typed_hvcat
254259
f = Reactant.compile((x_concrete,)) do x
255260
return Int[x x x; x x x]
256261
end
257262
@test f(x_concrete) == ones(Int, 2, 3)
263+
@test eltype(f(x_concrete)) === Int
258264
end
259265

260266
@testset "1-dim" begin
@@ -272,36 +278,42 @@ end
272278
return [x; x; x]
273279
end
274280
@test f(x_concrete) == ones(Bool, 6)
281+
@test eltype(f(x_concrete)) === Bool
275282

276283
# hcat
277284
f = Reactant.compile((x_concrete,)) do x
278285
return [x x x]
279286
end
280287
@test f(x_concrete) == ones(Bool, 2, 3)
288+
@test eltype(f(x_concrete)) === Bool
281289

282290
# hvcat
283291
f = Reactant.compile((x_concrete,)) do x
284292
return [x x x; x x x]
285293
end
286294
@test f(x_concrete) == ones(Bool, 4, 3)
295+
@test eltype(f(x_concrete)) === Bool
287296

288297
# typed_vcat
289298
f = Reactant.compile((x_concrete,)) do x
290299
return Int[x; x; x]
291300
end
292301
@test f(x_concrete) == ones(Int, 6)
302+
@test eltype(f(x_concrete)) === Int
293303

294304
# typed_hcat
295305
f = Reactant.compile((x_concrete,)) do x
296306
return Int[x; x; x]
297307
end
298308
@test f(x_concrete) == ones(Int, 2, 3)
309+
@test eltype(f(x_concrete)) === Int
299310

300311
# typed_hvcat
301312
f = Reactant.compile((x_concrete,)) do x
302313
return Int[x x x; x x x]
303314
end
304315
@test f(x_concrete) == ones(Int, 4, 3)
316+
@test eltype(f(x_concrete)) === Int
305317
end
306318

307319
x = ones(2, 4, 3)

0 commit comments

Comments
 (0)