-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed serialization order of fixed64, fallback to parseInt with no lo…
…ng lib, see #534
- Loading branch information
Showing
12 changed files
with
146 additions
and
73 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
var tape = require("tape"); | ||
|
||
var protobuf = require(".."); | ||
|
||
tape.test("fixed64", function(test) { | ||
|
||
var root = protobuf.Root.fromJSON({ | ||
nested: { | ||
test: { | ||
nested: { | ||
Test: { | ||
fields: { | ||
int_64: { | ||
type: 'fixed64', | ||
id: 1 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
|
||
var Test = root.lookup("test.Test"); | ||
|
||
var buffer = Test.encode({ | ||
int_64: '314159265358979' | ||
}).finish(); | ||
|
||
test.equal(buffer.length, 9, "should encode a total of 9 bytes"); | ||
test.equal(buffer[0], 9, "should encode id 1, wireType 1"); | ||
|
||
var decoded = Test.decode(buffer); | ||
// decoded.int_64 is a Long here, so this implicitly calls Long#toString: | ||
test.ok(decoded.int_64 == '314159265358979', "should decode back the original value"); | ||
|
||
test.end(); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters