1
1
var tape = require ( 'tape' )
2
2
var Hash = require ( '../hash' )
3
-
4
3
var hex = '0A1B2C3D4E5F6G7H'
5
4
6
5
function equal ( t , a , b ) {
7
6
t . equal ( a . length , b . length )
8
7
t . equal ( a . toString ( 'hex' ) , b . toString ( 'hex' ) )
9
8
}
10
9
11
- var hexBuf = new Buffer ( '0A1B2C3D4E5F6G7H' , 'utf8' )
10
+ var hexBuf = Buffer . from ( '0A1B2C3D4E5F6G7H' , 'utf8' )
12
11
var count16 = {
13
12
strings : [ '0A1B2C3D4E5F6G7H' ] ,
14
13
buffers : [
15
14
hexBuf ,
16
- new Buffer ( '80000000000000000000000000000080' , 'hex' )
15
+ Buffer . from ( '80000000000000000000000000000080' , 'hex' )
17
16
]
18
17
}
19
18
20
19
var empty = {
21
20
strings : [ '' ] ,
22
21
buffers : [
23
- new Buffer ( '80000000000000000000000000000000' , 'hex' )
22
+ Buffer . from ( '80000000000000000000000000000000' , 'hex' )
24
23
]
25
24
}
26
25
27
26
var multi = {
28
27
strings : [ 'abcd' , 'efhijk' , 'lmnopq' ] ,
29
28
buffers : [
30
- new Buffer ( 'abcdefhijklmnopq' , 'ascii' ) ,
31
- new Buffer ( '80000000000000000000000000000080' , 'hex' )
29
+ Buffer . from ( 'abcdefhijklmnopq' , 'ascii' ) ,
30
+ Buffer . from ( '80000000000000000000000000000080' , 'hex' )
32
31
]
33
32
}
34
33
@@ -37,14 +36,14 @@ var long = {
37
36
buffers : [
38
37
hexBuf ,
39
38
hexBuf ,
40
- new Buffer ( '80000000000000000000000000000100' , 'hex' )
39
+ Buffer . from ( '80000000000000000000000000000100' , 'hex' )
41
40
]
42
41
}
43
42
44
43
function makeTest ( name , data ) {
45
44
tape ( name , function ( t ) {
46
45
var h = new Hash ( 16 , 8 )
47
- var hash = new Buffer ( 20 )
46
+ var hash = Buffer . alloc ( 20 )
48
47
var n = 2
49
48
var expected = data . buffers . slice ( )
50
49
// t.plan(expected.length + 1)
0 commit comments