return 'SUCCESS';
},
- opts: {},
tests: [
{ buffers: [ Buffer.from('abc'),
Buffer.from(new Uint8Array([0x64, 0x65, 0x66]).buffer, 1) ],
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ buf1: Buffer.from('abc'), buf2: Buffer.from('abc'), expected: 0 },
{ buf1: Buffer.from('abc'),
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ buf: Buffer.from('abc'), target: Buffer.from('abc'), expected: 0 },
{ buf: Buffer.from('abc'),
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ buf: Buffer.from('abcdef'), target: Buffer.from('123456'),
expected: 6, expected_buf: 'abcdef' },
return 'SUCCESS';
},
- opts: {},
tests: [
{ buf1: Buffer.from('abc'), buf2: Buffer.from('abc'), expected: true },
return 'SUCCESS';
},
- opts: {},
tests: [
{ buf: Buffer.from('abc'), value: 0x61, expected: 'aaa' },
{ buf: Buffer.from('abc'), value: 0x61, expected: 'aaa', offset: 0, end: 3 },
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ buf: Buffer.from('abcdef'), value: 'abc', expected: true },
{ buf: Buffer.from('abcdef'), value: 'def', expected: true },
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ buf: Buffer.from('abcdef'), value: 'abc', expected: 0 },
{ buf: Buffer.from('abcdef'), value: 'def', expected: 3 },
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ value: Buffer.from('α'), expected: true },
{ value: new Uint8Array(10), expected: false },
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ value: 'utf-8', expected: true },
{ value: 'utf8', expected: true },
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ buf: Buffer.from('abcdef'), value: 'abc', expected: 0 },
{ buf: Buffer.from('abcabc'), value: 'abc', expected: 3 },
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ buf: Buffer.from([0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff]), offset: 0,
expected: [ -86,170,-17494,-21829,48042,43707,-573785174,-1430532899,3721182122,2864434397 ] },
return 'SUCCESS';
},
- opts: {},
-
tests: [
{}
],
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ buf: Buffer.from([0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff]), offset: 0, length: 1,
expected: [ 170, 170, -86, -86 ] },
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ buf: Buffer.from('abcdef'), start: 1, expected: 'bcdef' },
{ buf: Buffer.from('abcdef'), start: 1, end: 3, expected: 'bc' },
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ buf: Buffer.from('abcdef'), start: 0, end: 3, expected: 'Zbc' },
{ buf: Buffer.from('abcdef'), start: 1, expected: 'bcdef' },
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ value: '', expected: { type: 'Buffer', data: [] } },
{ value: 'αβγ', expected: { type: 'Buffer', data: [0xCE, 0xB1, 0xCE, 0xB2, 0xCE, 0xB3] } },
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ value: 'abc', expected: 3, expected_buf: 'abcZZZZZZZ' },
{ value: 'abc', offset: 1, expected: 3, expected_buf: 'ZabcZZZZZZ' },
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ write: 'writeInt8', value: 0xaa, exception: 'RangeError: Index out of range' },
{ write: 'writeInt8', value: 0x00, offset: 3, expected: 4, expected_buf: '5a5a5a005a5a5a5a5a5a' },
return 'SUCCESS';
},
- opts: {},
-
tests: [
{ write: 'writeUIntLE', value: 0xaa, length: 1,
exception: 'RangeError: Index out of range' },