Skip to content

Commit aee34b9

Browse files
committed
add test for random integers
1 parent 404110a commit aee34b9

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,14 @@ describe('MD5', function () {
55
it('should return the expected MD5 hash for "message"', function () {
66
assert.equal('78e731027d8fd50ed642340b7c9a63b3', md5('message'));
77
});
8+
9+
it('should not return the same hash for random numbers twice', function () {
10+
var msg1 = Math.floor((Math.random() * 100000) + 1) + (new Date).getTime();
11+
var msg2 = Math.floor((Math.random() * 100000) + 1) + (new Date).getTime();
12+
13+
if (msg1 !== msg2)
14+
assert.notEqual(md5(msg1), md5(msg2));
15+
else
16+
assert.equal(md5(msg1), md5(msg1));
17+
});
818
});

0 commit comments

Comments
 (0)