Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot encode/decode a negative int32 #38

Open
jbrophy60 opened this issue May 31, 2018 · 0 comments
Open

Cannot encode/decode a negative int32 #38

jbrophy60 opened this issue May 31, 2018 · 0 comments

Comments

@jbrophy60
Copy link

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 )

jbrophy60 pushed a commit to jbrophy60/lua-pb that referenced this issue May 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant