diff --git a/src/RoundingIntegers.jl b/src/RoundingIntegers.jl index 148d6b6..7f85aff 100644 --- a/src/RoundingIntegers.jl +++ b/src/RoundingIntegers.jl @@ -33,6 +33,7 @@ else const RUInt = RUInt64 end +itype(::Type{RInteger}) = Integer itype(::Type{RSigned}) = Signed itype(::Type{RUnsigned}) = Unsigned itype(::Type{RInt8}) = Int8 diff --git a/test/runtests.jl b/test/runtests.jl index f995616..ee5c5bc 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -18,6 +18,8 @@ end @test x === 5 @test isa(convert(RUInt8, 2), RUInt8) @test -7 % RUInt8 === RUInt8(0xf9) + @test convert(RInteger, 3) === RInt(3) + @test convert(RInteger, 0x03) === RUInt8(3) @test typemin(RInt16) === RInt16(typemin(Int16)) @test typemin(RInt32) === RInt32(typemin(Int32))