Skip to content

Cannot encode/decode a negative int32 #38

Open
@jbrophy60

Description

@jbrophy60

int32.proto:

message TestInt32
{
optional int32 int32_ = 1;
}

The following test fails when value is a negative number:

local pb = require"pb"
local value = -1
local integer32 = require"int32"

local msg = integer32.TestInt32()
msg.int32_ = value;
binary,err = msg:Serialize();
assert(not err)

local decoded = integer32.TestInt32():Parse(binary)
assert(decoded:IsInitialized())
assert(decoded:HasField('int32_'))
assert(value == decoded.int32_)

(similar to #35 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions