ppx_deriving_protobuf
ppx_deriving_protobuf copied to clipboard
Overflow test failed
# Error: Test ppx_protobuf:0:Test wire format:2:test_overflow (in the log).
#
# File "src_test/test_wire.ml", line 92, characters 1-1:
# Error: Test ppx_protobuf:0:Test wire format:2:test_overflow (in the code).
#
# expected exception Protobuf.Decoder.Failure(Overflow("")), but no exception was raised.
# ------------------------------------------------------------------------------
# Ran: 31 tests in: 0.16 seconds.
# FAILED: Cases: 31 Tried: 31 Errors: 1 Failures: 1 Skip: 0 Todo: 0 Timeouts: 0.
Why
let test_overflow ctxt =
if Sys.word_size = 32 then
assert_raises Decoder.(Failure (Overflow ""))
(fun () -> Decoder.int_of_int32 "" 0xffffffffl)
else
should overflow? 0xffffffffl = -1
on 32 bit systems - perfectly fits to int
Oh, hm. Then the test is wrong. It should test for something like 0x7fffffff
, an int32
value that doesn't fot into int
. (Maybe Int32.max_int
?) Can you please fix it and send a PR?