Skip to content

Commit

Permalink
proper reference tests for zero padding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Feb 21, 2011
1 parent 099b644 commit 3bcb089
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions test/buf.js
Expand Up @@ -143,13 +143,31 @@ exports.toBuf = function () {
[].slice.call(bigint(43135012110).toBuffer({
endian : 'little', size : 4
})),
[ 0x0d, 0x0c, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x0e ]
[ 0x00, 0x00, 0x00, 0x0a, 0x0e, 0x0d, 0x0c, 0x0b ]
);

assert.eql(
[].slice.call(bigint(43135012110).toBuffer({
endian : 'big', size : 4
})),
[ 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x00, 0x00, 0x00 ]
[ 0x00, 0x00, 0x00, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e ]
);
};

exports.zeroPad = function () {
var b = bigint(0x123456);

assert.eql(
[].slice.call(
b.toBuffer({ endian : 'big', size:4 })
),
[ 0x00, 0x12, 0x34, 0x56 ]
);

assert.eql(
[].slice.call(
b.toBuffer({ endian : 'little', size:4 })
),
[ 0x00, 0x56, 0x34, 0x12 ]
);
};

0 comments on commit 3bcb089

Please sign in to comment.