Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var assert = require('assert');
var binary = require('binary');
var sys = require('sys');
assert.equal(0, binary.packByte(0), 'pack_byte: 0');
assert.equal(255, binary.packByte(255), 'pack_byte: 255');
assert.equal(0, binary.unpackByte([0]), 'unpack_byte: 0');
assert.equal(255, binary.unpackByte([255]), 'unpack_byte: 255');
assert.deepEqual([0, 0], binary.packShort(0), 'pack_short: 0');
assert.deepEqual([0, 255], binary.packShort(255), 'pack_short: 255');
assert.deepEqual([1, 1], binary.packShort(257), 'pack_short: 256');
assert.equal(0, binary.unpackShort([0,0]), 'unpack_short: 0');
assert.equal(255, binary.unpackShort([0,255]), 'unpack_short: 255');
assert.equal(257, binary.unpackShort([1,1]), 'unpack_short: 257');
assert.deepEqual([0, 0, 0, 0], binary.packInt(0), 'pack_int: 0');
assert.deepEqual([0, 0, 0, 255], binary.packInt(255), 'pack_int: 255');
assert.deepEqual([109,115,112,105], binary.packInt('mspi'), 'pack_int: mspi');
assert.deepEqual([0, 0, 1, 1], binary.packInt(257), 'pack_int: 256');
assert.equal(0, binary.unpackInt([0,0,0,0]), 'unpack_int: 0');
assert.equal(1, binary.unpackInt([0,0,0,1]), 'unpack_int: 1');
assert.equal(257, binary.unpackInt([0,0,1,1]), 'unpack_int: 257');
assert.deepEqual([ 0, 0, 0, 0, 0, 0, 0, 1 ], binary.packLong(1), 'pack_long: 1');
var assert = require('assert');
var binary = require('binary');
var sys = require('sys');
assert.equal(0, binary.packByte(0), 'pack_byte: 0');
assert.equal(255, binary.packByte(255), 'pack_byte: 255');
assert.equal(0, binary.unpackByte([0]), 'unpack_byte: 0');
assert.equal(255, binary.unpackByte([255]), 'unpack_byte: 255');
assert.deepEqual([0, 0], binary.packShort(0), 'pack_short: 0');
assert.deepEqual([0, 255], binary.packShort(255), 'pack_short: 255');
assert.deepEqual([1, 1], binary.packShort(257), 'pack_short: 256');
assert.equal(0, binary.unpackShort([0,0]), 'unpack_short: 0');
assert.equal(255, binary.unpackShort([0,255]), 'unpack_short: 255');
assert.equal(257, binary.unpackShort([1,1]), 'unpack_short: 257');
assert.deepEqual([0, 0, 0, 0], binary.packInt(0), 'pack_int: 0');
assert.deepEqual([0, 0, 0, 255], binary.packInt(255), 'pack_int: 255');
assert.deepEqual([109,115,112,105], binary.packInt('mspi'), 'pack_int: mspi');
assert.deepEqual([0, 0, 1, 1], binary.packInt(257), 'pack_int: 256');
assert.equal(0, binary.unpackInt([0,0,0,0]), 'unpack_int: 0');
assert.equal(1, binary.unpackInt([0,0,0,1]), 'unpack_int: 1');
assert.equal(257, binary.unpackInt([0,0,1,1]), 'unpack_int: 257');
assert.deepEqual([ 0, 0, 0, 0, 0, 0, 0, 1 ], binary.packLong(1), 'pack_long: 1');
var assert = require('assert');
var binary = require('binary');
var sys = require('sys');
assert.equal(0, binary.packByte(0), 'pack_byte: 0');
assert.equal(255, binary.packByte(255), 'pack_byte: 255');
assert.equal(0, binary.unpackByte([0]), 'unpack_byte: 0');
assert.equal(255, binary.unpackByte([255]), 'unpack_byte: 255');
assert.deepEqual([0, 0], binary.packShort(0), 'pack_short: 0');
assert.deepEqual([0, 255], binary.packShort(255), 'pack_short: 255');
assert.deepEqual([1, 1], binary.packShort(257), 'pack_short: 256');
assert.equal(0, binary.unpackShort([0,0]), 'unpack_short: 0');
assert.equal(255, binary.unpackShort([0,255]), 'unpack_short: 255');
assert.equal(257, binary.unpackShort([1,1]), 'unpack_short: 257');
assert.deepEqual([0, 0, 0, 0], binary.packInt(0), 'pack_int: 0');
assert.deepEqual([0, 0, 0, 255], binary.packInt(255), 'pack_int: 255');
assert.deepEqual([109,115,112,105], binary.packInt('mspi'), 'pack_int: mspi');
assert.deepEqual([0, 0, 1, 1], binary.packInt(257), 'pack_int: 256');
assert.equal(0, binary.unpackInt([0,0,0,0]), 'unpack_int: 0');
assert.equal(1, binary.unpackInt([0,0,0,1]), 'unpack_int: 1');
assert.equal(257, binary.unpackInt([0,0,1,1]), 'unpack_int: 257');