Skip to content

Commit

Permalink
Tests to ensure no interference with SaferIntegers
Browse files Browse the repository at this point in the history
  • Loading branch information
BioTurboNick committed May 7, 2024
1 parent 63314b2 commit 6f1995d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ julia = "1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
SaferIntegers = "88634af6-177f-5301-88b8-7819386cfa38"

[targets]
test = ["Test"]
test = ["Test", "SaferIntegers"]
13 changes: 13 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -288,3 +288,16 @@ end
@test @unchecked(1 + 4 + 5 + typemax(Int)) == 10 + typemax(Int)
@test @checked(1.0 + 4 + 5 + typemax(Int)) == 9.223372036854776e18
end

using SaferIntegers

@testset "Ensure SaferIntegers are still safer" begin
@test_throws OverflowError typemax(SafeInt) + 1
@test_throws OverflowError @unchecked typemax(SafeInt) + 1
(@__MODULE__).eval(:(
module UncheckedDefaultSaferIntStillChecksModule
using OverflowContexts, SaferIntegers, Test
@default_unchecked
@test_throws OverflowError typemax(SafeInt) + 1
end))
end

0 comments on commit 6f1995d

Please sign in to comment.