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:
Roman Shtylman 2013-02-17 00:39:15 -05:00
parent a6f05fb505
commit 0faac29134
35 changed files with 3401 additions and 3169 deletions

15
test/base58.js Normal file
View file

@ -0,0 +1,15 @@
var assert = require('assert');
var base58 = require('../').base58;
var conv = require('../').convert;
test('decode base58', function() {
var enc = '5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ';
var hex = '800c28fca386c7a227600b2fe50b7cae11ec86d3bf1fbe471be89827e19d72aa1d507a5b8d';
assert.deepEqual(base58.decode(enc), conv.hexToBytes(hex));
});
test('encode base58', function() {
var enc = '5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ';
var hex = '800c28fca386c7a227600b2fe50b7cae11ec86d3bf1fbe471be89827e19d72aa1d507a5b8d';
assert.equal(base58.encode(conv.hexToBytes(hex)), enc);
});