@@ -91,6 +91,36 @@ const IntegerTypes = (SignedIntegerTypes..., UnsignedIntegerTypes...)
91
91
end
92
92
end
93
93
end
94
+
95
+ @testset " $T " for T in UnsignedIntegerTypes
96
+ @testset " $V " for V in (UInt64, UInt128, BigInt)
97
+ @test ! FixedPointDecimals. _check_overflows (T, V (0 ), true )
98
+ @test ! FixedPointDecimals. _check_overflows (T, V (0 ), false )
99
+ @test ! FixedPointDecimals. _check_overflows (T, V (1 ), false )
100
+
101
+ if V === BigInt
102
+ @test FixedPointDecimals. _check_overflows (T, V (1 ), true )
103
+ @test FixedPointDecimals. _check_overflows (T, V (typemax (T) - 1 ), true )
104
+ @test FixedPointDecimals. _check_overflows (T, V (typemax (T)), true )
105
+ @test FixedPointDecimals. _check_overflows (T, V (V (typemax (T)) + 1 ), true )
106
+ @test FixedPointDecimals. _check_overflows (T, V (V (typemax (T)) + 2 ), true )
107
+ end
108
+
109
+ if V === BigInt || typemax (T) == typemax (V)
110
+ @test ! FixedPointDecimals. _check_overflows (T, V (typemax (T) - 1 ), false )
111
+ @test ! FixedPointDecimals. _check_overflows (T, V (typemax (T)), false )
112
+ end
113
+
114
+ if V === BigInt || typemax (T) < typemax (V)
115
+ @test FixedPointDecimals. _check_overflows (T, V (V (typemax (T)) + 1 ), false )
116
+ @test FixedPointDecimals. _check_overflows (T, V (V (typemax (T)) + 2 ), false )
117
+ end
118
+
119
+ if V != = BigInt && typemax (T) > typemax (V)
120
+ @test ! FixedPointDecimals. _check_overflows (T, typemax (V), false )
121
+ end
122
+ end
123
+ end
94
124
end
95
125
96
126
T = Int64
427
457
end
428
458
end # @testset "xparse"
429
459
430
-
431
460
@testset " parse" begin
432
461
# Note: the underscore used in the reinterpreted integer is used to indicate the decimal
433
462
# place.
@@ -553,8 +582,7 @@ end # @testset "xparse"
553
582
@test_throws ArgumentError parse (FD4, " 1.2.3" )
554
583
@test_throws ArgumentError parse (FD4, " 1.2" , RoundUp)
555
584
end
556
- end
557
-
585
+ end # @testset "parse"
558
586
559
587
@testset " tryparse" begin
560
588
# Note: the underscore used in the reinterpreted integer is used to indicate the decimal
679
707
@test isnothing (tryparse (FD4, " 1.2e100" ))
680
708
@test isnothing (tryparse (FD4, " foo" ))
681
709
@test isnothing (tryparse (FD4, " 1.2.3" ))
682
- @test isnothing ( tryparse (FD4, " 1.2" , RoundUp) )
710
+ @test_throws ArgumentError tryparse (FD4, " 1.2" , RoundUp)
683
711
end
684
- end
712
+ end # @testset "tryparse"
0 commit comments