Comparing version 0.0.6 to 0.0.7
{ | ||
"name": "rlp", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Recursive Length Prefix Encoding Module", | ||
@@ -10,3 +10,4 @@ "main": "index.js", | ||
"scripts": { | ||
"test": "./node_modules/mocha/bin/mocha --timeout 5000 --reporter spec ./test/" | ||
"test": "./node_modules/mocha/bin/mocha --timeout 5000 --reporter spec ./test/", | ||
"webtest": "browserify test/max.js | testling -u" | ||
}, | ||
@@ -27,4 +28,4 @@ "repository": { | ||
"author": { | ||
"name": "null_radix", | ||
"email": "null_radix@riseup.net" | ||
"name": "martin becze", | ||
"email": "mjbecze@gmail.com" | ||
}, | ||
@@ -37,4 +38,17 @@ "license": "GPL", | ||
"mocha": "~1.17.1", | ||
"bignum": "^0.7.0" | ||
"bn.js": "*" | ||
}, | ||
"testling": { | ||
"files": "test/*.js", | ||
"harness" : "mocha-bdd", | ||
"browsers": [ | ||
"chrome/22..latest", | ||
"firefox/16..latest", | ||
"safari/latest", | ||
"opera/11.0..latest", | ||
"iphone/6", | ||
"ipad/6", | ||
"android-browser/latest" | ||
] | ||
} | ||
} |
var assert = require('assert'); | ||
var fs = require('fs'); | ||
var Bignum = require('bignum'); | ||
var Bignum = require('bn.js'); | ||
var RLP = require('../index.js'); | ||
var officalTests = require('./jsonTests/rlptest.json'); | ||
@@ -154,21 +155,14 @@ describe('RLP encoding (string):', function() { | ||
describe('offical tests', function () { | ||
var jsonTests; | ||
before(function () { | ||
var data = fs.readFileSync('./test/jsonTests/rlptest.json') | ||
jsonTests = JSON.parse(data); | ||
}); | ||
it('pass all tests', function (done) { | ||
for (test in jsonTests) { | ||
console.log(test); | ||
for (var test in officalTests) { | ||
var incoming = jsonTests[test].in | ||
var incoming = officalTests[test].in ; | ||
//if we are testing a big number | ||
if(incoming[0] == '#'){ | ||
if(incoming[0] === '#'){ | ||
var bn = new Bignum(incoming.slice(1)); | ||
incoming = bn.toBuffer() | ||
incoming = new Buffer(bn.toArray()); | ||
} | ||
var encoded = RLP.encode(incoming); | ||
assert.equal(encoded.toString('hex'), jsonTests[test].out.toLowerCase()); | ||
assert.equal(encoded.toString('hex'), officalTests[test].out.toLowerCase()); | ||
} | ||
@@ -175,0 +169,0 @@ done(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
1
58622
16
1443