start to split into node commonjs style modules
- no longer is the global Bitcoin used for modules - cleaner and more maintainable code - add more tests
This commit is contained in:
parent
a6f05fb505
commit
0faac29134
35 changed files with 3401 additions and 3169 deletions
test
24
test/convert.js
Normal file
24
test/convert.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
var assert = require('assert');
|
||||
var conv = require('../').convert;
|
||||
|
||||
var bytesToHex = conv.bytesToHex;
|
||||
var hexToBytes = conv.hexToBytes;
|
||||
|
||||
test('bytesToHex', function() {
|
||||
assert.equal(bytesToHex([0, 1, 2, 255]), '000102ff');
|
||||
});
|
||||
|
||||
test('hexToBytes', function() {
|
||||
assert.deepEqual(hexToBytes('000102ff'), [0, 1, 2, 255]);
|
||||
});
|
||||
|
||||
test('bytesToHex - hexToBytes', function() {
|
||||
var bytes = [];
|
||||
for (var i=0 ; i<256 ; ++i) {
|
||||
bytes.push(i);
|
||||
}
|
||||
|
||||
var hex = bytesToHex(bytes);
|
||||
assert.equal(hex.length, 512);
|
||||
assert.deepEqual(hexToBytes(hex), bytes);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue