]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - apps/tidep0084.git/blob - example/iot-gateway/node_modules/protocol-buffers/test/notpacked.js
Initial commit
[apps/tidep0084.git] / example / iot-gateway / node_modules / protocol-buffers / test / notpacked.js
1 var tape = require('tape')
2 var fs = require('fs')
3 var protobuf = require('../')
4 var NotPacked = protobuf(fs.readFileSync(__dirname + '/test.proto')).NotPacked
5 var FalsePacked = protobuf(fs.readFileSync(__dirname + '/test.proto')).FalsePacked
7 tape('NotPacked encode + FalsePacked decode', function (t) {
8   var b1 = NotPacked.encode({
9     id: [ 9847136125 ],
10     value: 10000
11   })
13   var o1 = FalsePacked.decode(b1)
15   t.same(o1.id.length, 1)
16   t.same(o1.id[0], 9847136125)
18   t.end()
19 })
21 tape('FalsePacked encode + NotPacked decode', function (t) {
22   var b1 = FalsePacked.encode({
23     id: [ 9847136125 ],
24     value: 10000
25   })
27   var o1 = NotPacked.decode(b1)
29   t.same(o1.id.length, 1)
30   t.same(o1.id[0], 9847136125)
32   t.end()
33 })