Browse Source

reduce number of cases for browser

patch-2
Manuel Araoz 11 years ago
parent
commit
2a829c4525
  1. 1
      test/index.html
  2. 5
      test/test.random.js

1
test/index.html

@ -32,6 +32,7 @@
<script src="test.PeerManager.js"></script> <script src="test.PeerManager.js"></script>
<script src="test.Point.js"></script> <script src="test.Point.js"></script>
<script src="test.PrivateKey.js"></script> <script src="test.PrivateKey.js"></script>
<script src="test.random.js"></script>
<script src="test.RpcClient.js"></script> <script src="test.RpcClient.js"></script>
<script src="test.Script.js"></script> <script src="test.Script.js"></script>
<script src="test.ScriptInterpreter.js"></script> <script src="test.ScriptInterpreter.js"></script>

5
test/test.random.js

@ -9,7 +9,7 @@ var should = chai.should();
var Key = bitcore.Key; var Key = bitcore.Key;
describe('Key randomness tests', function() { describe('Key randomness tests', function() {
var RUNS = 128; var RUNS = 32;
it('should pass Frequency (Monobits) Test', function() { it('should pass Frequency (Monobits) Test', function() {
/* /*
Description: The focus of the test is the proportion Description: The focus of the test is the proportion
@ -61,17 +61,14 @@ describe('Key randomness tests', function() {
(p1-0.5).should.be.below(0.01); (p1-0.5).should.be.below(0.01);
}); });
var getBitInByte = function(b, index) { var getBitInByte = function(b, index) {
index.should.be.below(8);
return (b >> index) & 1; return (b >> index) & 1;
}; };
var getBitInKey = function(key, index) { var getBitInKey = function(key, index) {
var bindex = parseInt(index / 8); var bindex = parseInt(index / 8);
bindex.should.be.below(key.length);
return getBitInByte(key[bindex], index - bindex * 8); return getBitInByte(key[bindex], index - bindex * 8);
}; };
var getBitInKeys = function(keys, index) { var getBitInKeys = function(keys, index) {
var kindex = parseInt(index / (keys[0].length*8)); var kindex = parseInt(index / (keys[0].length*8));
kindex.should.be.below(keys.length);
return getBitInKey(keys[kindex], index - (keys[0].length*8) * kindex); return getBitInKey(keys[kindex], index - (keys[0].length*8) * kindex);
}; };
it('should pass Runs Test', function() { it('should pass Runs Test', function() {

Loading…
Cancel
Save