Skip to content

Commit 12afe1c

Browse files
committed
Correct multiarg method tests and add saturating
1 parent 805078b commit 12afe1c

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

test/runtests.jl

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -398,15 +398,20 @@ end
398398
end
399399

400400
@testset "multiargument methods" begin
401-
@test @checked(1 + 4 + 5) == 10
402-
@test_throws OverflowError @checked(typemax(Int) + 1 + 4 + 5)
403-
@test_throws OverflowError @checked(1 + 4 + 5 + typemax(Int))
404-
@test @checked(1.0 + 4 + 5 + typemax(Int)) == 9.223372036854776e18
401+
@test @checked(+(1, 4, 5)) == 10
402+
@test_throws OverflowError @checked(+(typemax(Int), 1, 4, 5))
403+
@test_throws OverflowError @checked(+(1, 4, 5, typemax(Int)))
404+
@test @checked(+(1.0, 4, 5, typemax(Int))) == 9.223372036854776e18
405405

406-
@test @unchecked(1 + 4 + 5) == 10
407-
@test @unchecked(typemax(Int) + 1 + 4 + 5) == 10 + typemax(Int)
408-
@test @unchecked(1 + 4 + 5 + typemax(Int)) == 10 + typemax(Int)
409-
@test @checked(1.0 + 4 + 5 + typemax(Int)) == 9.223372036854776e18
406+
@test @unchecked(+(1, 4, 5)) == 10
407+
@test @unchecked(+(typemax(Int), 1, 4, 5)) == 10 + typemax(Int)
408+
@test @unchecked(+(1, 4, 5, typemax(Int))) == 10 + typemax(Int)
409+
@test @unchecked(+(1.0, 4, 5, typemax(Int))) == 9.223372036854776e18
410+
411+
@test @saturating(+(1, 4, 5)) == 10
412+
@test @saturating(+(typemax(Int), 1, 4, 5)) == typemax(Int)
413+
@test @saturating(+(1, 4, 5, typemax(Int))) == typemax(Int)
414+
@test @saturating(+(1.0, 4, 5, typemax(Int))) == 9.223372036854776e18
410415
end
411416

412417
using SaferIntegers

0 commit comments

Comments
 (0)