This repository was archived by the owner on Jul 12, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.js
More file actions
101 lines (95 loc) · 3.11 KB
/
test.js
File metadata and controls
101 lines (95 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
"use strict";
/**
* Testing Libraries
*/
var buster = require("buster");
var assert = buster.referee.assert;
/**
* Setup
*/
var hsimp = require("./bootstrap")(require("./main"));
hsimp.setOptions({
"calculationsPerSecond": 1e10
});
/**
* Tests
*/
buster.testCase("hsimp", {
"Possible Combinations": {
"password": function () {
assert.equals(hsimp("password").getPossibleCombinations(), 208827064576);
},
"Single Character": function () {
assert.equals(hsimp("a").getPossibleCombinations(), 26);
},
"40 Characters": function () {
assert.equals(hsimp("skdkfkdkfkekfkekfudkfieifidifieifieifiri").getPossibleCombinations(), 3.971311183896361e56);
},
"Mixed Character Sets": function () {
assert.equals(hsimp("abc123ABC").getPossibleCombinations(), 13537086546263552);
}
},
"Time In Seconds": {
"wkjhfakjsdfh": function () {
assert.equals(hsimp("wkjhfakjsdfh").getTimeInSeconds(), 9542895.666168218);
},
"Mixed Character Sets": function () {
assert.equals(hsimp("abc123ABC").getTimeInSeconds(), 1353708.6546263553);
}
},
"Time In Periods": {
"1111111111": function () {
assert.equals(hsimp("1111111111").getString(), "1 second");
},
"monkeycatfish": function () {
assert.equals(hsimp("monkeycatfish").getString(), "8 years");
},
"BowT1esAreC00l": function () {
assert.equals(hsimp("BowT1esAreC00l").getString(), "39 million years");
},
"8RTMRwNpDeP9JZb8ts77@W!fW@JC_Jtw9_Z!8rf#": function () {
assert.equals(hsimp("8RTMRwNpDeP9JZb8ts77@W!fW@JC_Jtw9_Z!8rf#").getString(), "9 octodecillion years");
}
},
"Time": {
"BowT1esAreC00l": function () {
assert.equals(hsimp("BowT1esAreC00l").getTimeString(), "39 million years");
}
},
"Checks": {
"password": function () {
assert.equals(hsimp("password").getChecks().length, 4);
},
"password string": function () {
assert.equals(hsimp("password").getString(), "Instantly");
},
"password time": function () {
assert.equals(hsimp("password").getTimeInSeconds(), 0);
}
},
"Security Level": {
"instant": {
"top10k": function () {
assert.equals(hsimp("password").getSecurityLevel(), "insecure");
}
},
"bad": {
"short": function () {
assert.equals(hsimp("dddddddddddd").getSecurityLevel(), "bad");
}
},
"ok": {
"short": function () {
assert.equals(hsimp("akduekfiejsiej").getSecurityLevel(), "ok");
},
"long with warning": function () {
assert.equals(hsimp("rrrhhhrrrhhhrrrhhhrrrhhh").getSecurityLevel(), "ok");
}
},
"good": {
"short": function () {
assert.equals(hsimp("ILikeToMoveItMoveItYeah!").getSecurityLevel(), "good");
}
}
}
});