speed up random test slightly
...by caching hexes. Also, correct the "1000" typo - it's actually 100.
This commit is contained in:
parent
4f71535869
commit
d689dbb77e
@ -17,13 +17,13 @@ describe('Random', function() {
|
|||||||
bytes1.toString('hex').should.not.equal(bytes2.toString('hex'));
|
bytes1.toString('hex').should.not.equal(bytes2.toString('hex'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate 1000 8 byte buffers in a row that are not equal', function() {
|
it('should generate 100 8 byte buffers in a row that are not equal', function() {
|
||||||
var bufs = [];
|
var hexs = [];
|
||||||
for (var i = 0; i < 100; i++)
|
for (var i = 0; i < 100; i++)
|
||||||
bufs[i] = Random.getRandomBuffer(8);
|
hexs[i] = Random.getRandomBuffer(8).toString('hex');
|
||||||
for (var i = 0; i < 100; i++)
|
for (var i = 0; i < 100; i++)
|
||||||
for (var j = i + 1; j < 100; j++)
|
for (var j = i + 1; j < 100; j++)
|
||||||
bufs[i].toString('hex').should.not.equal(bufs[j].toString('hex'));
|
hexs[i].should.not.equal(hexs[j]);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user