<commit_before><commit_msg>Added a first test - Bitcoin address en-/decoding.<commit_after>var path = require('path');
require.paths.unshift(path.join(__dirname, '..'));

var vows = require('vows'),
    assert = require('assert');

var Util = require('lib/util');

var suite = vows.describe('util');

suite.addBatch({
	'Bitcoin addresses': {
		'decode a bitcoin address': {
			topic: "12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX",

			'and check the result': function (topic) {
				var addrHash = Util.addressToPubKeyHash(topic);
				console.log(addrHash.toHex());
				assert.equal(Util.pubKeyHashToAddress(addrHash), topic);
			}
		},
		'encode a bitcoin address': {
			topic: new Buffer("119b098e2e980a229e139a9ed01a469e518e6f26", 'hex'),

			'and check the result': function (topic) {
				var addrHash = Util.pubKeyHashToAddress(topic);
				assert.equal(Util.addressToPubKeyHash(addrHash).compare(topic), 0);
			}
		}
	}
});

suite.run();
{'fraction_non_alphanumeric': 0.15450643776824036, 'fraction_numerical': 0.03862660944206009, 'mean_word_length': 4.723926380368098, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4572970', 'n_tokens_mistral': 384, 'n_tokens_neox': 329, 'n_words': 62}