@@ -7,49 +7,49 @@ const buf = Buffer.allocUnsafe(8);
7
7
[ 'LE' , 'BE' ] . forEach ( function ( endianness ) {
8
8
// Should allow simple BigInts to be written and read
9
9
let val = 123456789n ;
10
- buf [ ' writeBigInt64' + endianness ] ( val , 0 ) ;
11
- let rtn = buf [ ' readBigInt64' + endianness ] ( 0 ) ;
10
+ buf [ ` writeBigInt64${ endianness } ` ] ( val , 0 ) ;
11
+ let rtn = buf [ ` readBigInt64${ endianness } ` ] ( 0 ) ;
12
12
assert . strictEqual ( val , rtn ) ;
13
13
14
14
// Should allow INT64_MAX to be written and read
15
15
val = 0x7fffffffffffffffn ;
16
- buf [ ' writeBigInt64' + endianness ] ( val , 0 ) ;
17
- rtn = buf [ ' readBigInt64' + endianness ] ( 0 ) ;
16
+ buf [ ` writeBigInt64${ endianness } ` ] ( val , 0 ) ;
17
+ rtn = buf [ ` readBigInt64${ endianness } ` ] ( 0 ) ;
18
18
assert . strictEqual ( val , rtn ) ;
19
19
20
20
// Should read and write a negative signed 64-bit integer
21
21
val = - 123456789n ;
22
- buf [ ' writeBigInt64' + endianness ] ( val , 0 ) ;
23
- assert . strictEqual ( val , buf [ ' readBigInt64' + endianness ] ( 0 ) ) ;
22
+ buf [ ` writeBigInt64${ endianness } ` ] ( val , 0 ) ;
23
+ assert . strictEqual ( val , buf [ ` readBigInt64${ endianness } ` ] ( 0 ) ) ;
24
24
25
25
// Should read and write an unsigned 64-bit integer
26
26
val = 123456789n ;
27
- buf [ ' writeBigUInt64' + endianness ] ( val , 0 ) ;
28
- assert . strictEqual ( val , buf [ ' readBigUInt64' + endianness ] ( 0 ) ) ;
27
+ buf [ ` writeBigUInt64${ endianness } ` ] ( val , 0 ) ;
28
+ assert . strictEqual ( val , buf [ ` readBigUInt64${ endianness } ` ] ( 0 ) ) ;
29
29
30
30
// Should throw a RangeError upon INT64_MAX+1 being written
31
31
assert . throws ( function ( ) {
32
32
const val = 0x8000000000000000n ;
33
- buf [ ' writeBigInt64' + endianness ] ( val , 0 ) ;
33
+ buf [ ` writeBigInt64${ endianness } ` ] ( val , 0 ) ;
34
34
} , RangeError ) ;
35
35
36
36
// Should throw a RangeError upon UINT64_MAX+1 being written
37
37
assert . throws ( function ( ) {
38
38
const val = 0x10000000000000000n ;
39
- buf [ ' writeBigUInt64' + endianness ] ( val , 0 ) ;
39
+ buf [ ` writeBigUInt64${ endianness } ` ] ( val , 0 ) ;
40
40
} , {
41
41
code : 'ERR_OUT_OF_RANGE' ,
42
42
message : 'The value of "value" is out of range. It must be ' +
43
- '>= 0n and < 2n ** 64n. Received 18_446_744_073_709_551_616n'
43
+ '>= 0n and < 2n ** 64n. Received 18_446_744_073_709_551_616n'
44
44
} ) ;
45
45
46
46
// Should throw a TypeError upon invalid input
47
47
assert . throws ( function ( ) {
48
- buf [ ' writeBigInt64' + endianness ] ( 'bad' , 0 ) ;
48
+ buf [ ` writeBigInt64${ endianness } ` ] ( 'bad' , 0 ) ;
49
49
} , TypeError ) ;
50
50
51
51
// Should throw a TypeError upon invalid input
52
52
assert . throws ( function ( ) {
53
- buf [ ' writeBigUInt64' + endianness ] ( 'bad' , 0 ) ;
53
+ buf [ ` writeBigUInt64${ endianness } ` ] ( 'bad' , 0 ) ;
54
54
} , TypeError ) ;
55
55
} ) ;
0 commit comments