Skip to content

Commit 6aebafa

Browse files
committed
reduce test output size
1 parent 70bbebf commit 6aebafa

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

test/create-hash.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,26 @@ function runTest (name, createHash, algorithm) {
2424
var input = new Buffer(obj.input, 'base64')
2525
var node = obj[algorithm]
2626
var js = createHash(algorithm).update(input).digest('hex')
27-
t.equal(js, node, algorithm + '(testVector[' + i + ']) == ' + node)
27+
if (js !== node) {
28+
t.equal(js, node, algorithm + '(testVector[' + i + ']) == ' + node)
29+
}
2830

2931
encodings.forEach(function (encoding) {
3032
var input = new Buffer(obj.input, 'base64').toString(encoding)
3133
var node = obj[algorithm]
3234
var js = createHash(algorithm).update(input, encoding).digest('hex')
33-
t.equal(js, node, algorithm + '(testVector[' + i + '], ' + encoding + ') == ' + node)
35+
if (js !== node) {
36+
t.equal(js, node, algorithm + '(testVector[' + i + '], ' + encoding + ') == ' + node)
37+
}
3438
})
3539
input = new Buffer(obj.input, 'base64')
3640
node = obj[algorithm]
3741
var hash = createHash(algorithm)
3842
hash.end(input)
3943
js = hash.read().toString('hex')
40-
t.equal(js, node, algorithm + '(testVector[' + i + ']) == ' + node)
44+
if (js !== node) {
45+
t.equal(js, node, algorithm + '(testVector[' + i + ']) == ' + node)
46+
}
4147
setTimeout(run, 0, i + 1)
4248
}
4349
})

test/create-hmac.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ function testLib (name, createHmac) {
1818
.update(input.data, 'hex').digest()
1919

2020
output = input.truncate ? output.slice(0, input.truncate) : output
21-
t.equal(output.toString('hex'), input[alg])
21+
output = output.toString('hex')
22+
if (output !== input[alg]) {
23+
t.equal(output, input[alg])
24+
}
2225
setTimeout(run, 0, i + 1)
2326
}
2427
})
@@ -36,7 +39,10 @@ function testLib (name, createHmac) {
3639
var output = hmac.read()
3740

3841
output = input.truncate ? output.slice(0, input.truncate) : output
39-
t.equal(output.toString('hex'), input[alg])
42+
output = output.toString('hex')
43+
if (output !== input[alg]) {
44+
t.equal(output, input[alg])
45+
}
4046
setTimeout(run, 0, i + 1)
4147
}
4248
})

0 commit comments

Comments
 (0)