11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ciconst b = Buffer.from('abcdef');
61cb0ef41Sopenharmony_ciconst buf_a = Buffer.from('a');
71cb0ef41Sopenharmony_ciconst buf_bc = Buffer.from('bc');
81cb0ef41Sopenharmony_ciconst buf_f = Buffer.from('f');
91cb0ef41Sopenharmony_ciconst buf_z = Buffer.from('z');
101cb0ef41Sopenharmony_ciconst buf_empty = Buffer.from('');
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ciassert(b.includes('a'));
131cb0ef41Sopenharmony_ciassert(!b.includes('a', 1));
141cb0ef41Sopenharmony_ciassert(!b.includes('a', -1));
151cb0ef41Sopenharmony_ciassert(!b.includes('a', -4));
161cb0ef41Sopenharmony_ciassert(b.includes('a', -b.length));
171cb0ef41Sopenharmony_ciassert(b.includes('a', NaN));
181cb0ef41Sopenharmony_ciassert(b.includes('a', -Infinity));
191cb0ef41Sopenharmony_ciassert(!b.includes('a', Infinity));
201cb0ef41Sopenharmony_ciassert(b.includes('bc'));
211cb0ef41Sopenharmony_ciassert(!b.includes('bc', 2));
221cb0ef41Sopenharmony_ciassert(!b.includes('bc', -1));
231cb0ef41Sopenharmony_ciassert(!b.includes('bc', -3));
241cb0ef41Sopenharmony_ciassert(b.includes('bc', -5));
251cb0ef41Sopenharmony_ciassert(b.includes('bc', NaN));
261cb0ef41Sopenharmony_ciassert(b.includes('bc', -Infinity));
271cb0ef41Sopenharmony_ciassert(!b.includes('bc', Infinity));
281cb0ef41Sopenharmony_ciassert(b.includes('f'), b.length - 1);
291cb0ef41Sopenharmony_ciassert(!b.includes('z'));
301cb0ef41Sopenharmony_ciassert(b.includes(''));
311cb0ef41Sopenharmony_ciassert(b.includes('', 1));
321cb0ef41Sopenharmony_ciassert(b.includes('', b.length + 1));
331cb0ef41Sopenharmony_ciassert(b.includes('', Infinity));
341cb0ef41Sopenharmony_ciassert(b.includes(buf_a));
351cb0ef41Sopenharmony_ciassert(!b.includes(buf_a, 1));
361cb0ef41Sopenharmony_ciassert(!b.includes(buf_a, -1));
371cb0ef41Sopenharmony_ciassert(!b.includes(buf_a, -4));
381cb0ef41Sopenharmony_ciassert(b.includes(buf_a, -b.length));
391cb0ef41Sopenharmony_ciassert(b.includes(buf_a, NaN));
401cb0ef41Sopenharmony_ciassert(b.includes(buf_a, -Infinity));
411cb0ef41Sopenharmony_ciassert(!b.includes(buf_a, Infinity));
421cb0ef41Sopenharmony_ciassert(b.includes(buf_bc));
431cb0ef41Sopenharmony_ciassert(!b.includes(buf_bc, 2));
441cb0ef41Sopenharmony_ciassert(!b.includes(buf_bc, -1));
451cb0ef41Sopenharmony_ciassert(!b.includes(buf_bc, -3));
461cb0ef41Sopenharmony_ciassert(b.includes(buf_bc, -5));
471cb0ef41Sopenharmony_ciassert(b.includes(buf_bc, NaN));
481cb0ef41Sopenharmony_ciassert(b.includes(buf_bc, -Infinity));
491cb0ef41Sopenharmony_ciassert(!b.includes(buf_bc, Infinity));
501cb0ef41Sopenharmony_ciassert(b.includes(buf_f), b.length - 1);
511cb0ef41Sopenharmony_ciassert(!b.includes(buf_z));
521cb0ef41Sopenharmony_ciassert(b.includes(buf_empty));
531cb0ef41Sopenharmony_ciassert(b.includes(buf_empty, 1));
541cb0ef41Sopenharmony_ciassert(b.includes(buf_empty, b.length + 1));
551cb0ef41Sopenharmony_ciassert(b.includes(buf_empty, Infinity));
561cb0ef41Sopenharmony_ciassert(b.includes(0x61));
571cb0ef41Sopenharmony_ciassert(!b.includes(0x61, 1));
581cb0ef41Sopenharmony_ciassert(!b.includes(0x61, -1));
591cb0ef41Sopenharmony_ciassert(!b.includes(0x61, -4));
601cb0ef41Sopenharmony_ciassert(b.includes(0x61, -b.length));
611cb0ef41Sopenharmony_ciassert(b.includes(0x61, NaN));
621cb0ef41Sopenharmony_ciassert(b.includes(0x61, -Infinity));
631cb0ef41Sopenharmony_ciassert(!b.includes(0x61, Infinity));
641cb0ef41Sopenharmony_ciassert(!b.includes(0x0));
651cb0ef41Sopenharmony_ci
661cb0ef41Sopenharmony_ci// test offsets
671cb0ef41Sopenharmony_ciassert(b.includes('d', 2));
681cb0ef41Sopenharmony_ciassert(b.includes('f', 5));
691cb0ef41Sopenharmony_ciassert(b.includes('f', -1));
701cb0ef41Sopenharmony_ciassert(!b.includes('f', 6));
711cb0ef41Sopenharmony_ci
721cb0ef41Sopenharmony_ciassert(b.includes(Buffer.from('d'), 2));
731cb0ef41Sopenharmony_ciassert(b.includes(Buffer.from('f'), 5));
741cb0ef41Sopenharmony_ciassert(b.includes(Buffer.from('f'), -1));
751cb0ef41Sopenharmony_ciassert(!b.includes(Buffer.from('f'), 6));
761cb0ef41Sopenharmony_ci
771cb0ef41Sopenharmony_ciassert(!Buffer.from('ff').includes(Buffer.from('f'), 1, 'ucs2'));
781cb0ef41Sopenharmony_ci
791cb0ef41Sopenharmony_ci// test hex encoding
801cb0ef41Sopenharmony_ciassert.strictEqual(
811cb0ef41Sopenharmony_ci  Buffer.from(b.toString('hex'), 'hex')
821cb0ef41Sopenharmony_ci    .includes('64', 0, 'hex'),
831cb0ef41Sopenharmony_ci  true
841cb0ef41Sopenharmony_ci);
851cb0ef41Sopenharmony_ciassert.strictEqual(
861cb0ef41Sopenharmony_ci  Buffer.from(b.toString('hex'), 'hex')
871cb0ef41Sopenharmony_ci    .includes(Buffer.from('64', 'hex'), 0, 'hex'),
881cb0ef41Sopenharmony_ci  true
891cb0ef41Sopenharmony_ci);
901cb0ef41Sopenharmony_ci
911cb0ef41Sopenharmony_ci// Test base64 encoding
921cb0ef41Sopenharmony_ciassert.strictEqual(
931cb0ef41Sopenharmony_ci  Buffer.from(b.toString('base64'), 'base64')
941cb0ef41Sopenharmony_ci    .includes('ZA==', 0, 'base64'),
951cb0ef41Sopenharmony_ci  true
961cb0ef41Sopenharmony_ci);
971cb0ef41Sopenharmony_ciassert.strictEqual(
981cb0ef41Sopenharmony_ci  Buffer.from(b.toString('base64'), 'base64')
991cb0ef41Sopenharmony_ci    .includes(Buffer.from('ZA==', 'base64'), 0, 'base64'),
1001cb0ef41Sopenharmony_ci  true
1011cb0ef41Sopenharmony_ci);
1021cb0ef41Sopenharmony_ci
1031cb0ef41Sopenharmony_ci// test ascii encoding
1041cb0ef41Sopenharmony_ciassert.strictEqual(
1051cb0ef41Sopenharmony_ci  Buffer.from(b.toString('ascii'), 'ascii')
1061cb0ef41Sopenharmony_ci    .includes('d', 0, 'ascii'),
1071cb0ef41Sopenharmony_ci  true
1081cb0ef41Sopenharmony_ci);
1091cb0ef41Sopenharmony_ciassert.strictEqual(
1101cb0ef41Sopenharmony_ci  Buffer.from(b.toString('ascii'), 'ascii')
1111cb0ef41Sopenharmony_ci    .includes(Buffer.from('d', 'ascii'), 0, 'ascii'),
1121cb0ef41Sopenharmony_ci  true
1131cb0ef41Sopenharmony_ci);
1141cb0ef41Sopenharmony_ci
1151cb0ef41Sopenharmony_ci// Test latin1 encoding
1161cb0ef41Sopenharmony_ciassert.strictEqual(
1171cb0ef41Sopenharmony_ci  Buffer.from(b.toString('latin1'), 'latin1')
1181cb0ef41Sopenharmony_ci    .includes('d', 0, 'latin1'),
1191cb0ef41Sopenharmony_ci  true
1201cb0ef41Sopenharmony_ci);
1211cb0ef41Sopenharmony_ciassert.strictEqual(
1221cb0ef41Sopenharmony_ci  Buffer.from(b.toString('latin1'), 'latin1')
1231cb0ef41Sopenharmony_ci    .includes(Buffer.from('d', 'latin1'), 0, 'latin1'),
1241cb0ef41Sopenharmony_ci  true
1251cb0ef41Sopenharmony_ci);
1261cb0ef41Sopenharmony_ci
1271cb0ef41Sopenharmony_ci// Test binary encoding
1281cb0ef41Sopenharmony_ciassert.strictEqual(
1291cb0ef41Sopenharmony_ci  Buffer.from(b.toString('binary'), 'binary')
1301cb0ef41Sopenharmony_ci    .includes('d', 0, 'binary'),
1311cb0ef41Sopenharmony_ci  true
1321cb0ef41Sopenharmony_ci);
1331cb0ef41Sopenharmony_ciassert.strictEqual(
1341cb0ef41Sopenharmony_ci  Buffer.from(b.toString('binary'), 'binary')
1351cb0ef41Sopenharmony_ci    .includes(Buffer.from('d', 'binary'), 0, 'binary'),
1361cb0ef41Sopenharmony_ci  true
1371cb0ef41Sopenharmony_ci);
1381cb0ef41Sopenharmony_ci
1391cb0ef41Sopenharmony_ci
1401cb0ef41Sopenharmony_ci// test ucs2 encoding
1411cb0ef41Sopenharmony_cilet twoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2');
1421cb0ef41Sopenharmony_ci
1431cb0ef41Sopenharmony_ciassert(twoByteString.includes('\u0395', 4, 'ucs2'));
1441cb0ef41Sopenharmony_ciassert(twoByteString.includes('\u03a3', -4, 'ucs2'));
1451cb0ef41Sopenharmony_ciassert(twoByteString.includes('\u03a3', -6, 'ucs2'));
1461cb0ef41Sopenharmony_ciassert(twoByteString.includes(
1471cb0ef41Sopenharmony_ci  Buffer.from('\u03a3', 'ucs2'), -6, 'ucs2'));
1481cb0ef41Sopenharmony_ciassert(!twoByteString.includes('\u03a3', -2, 'ucs2'));
1491cb0ef41Sopenharmony_ci
1501cb0ef41Sopenharmony_ciconst mixedByteStringUcs2 =
1511cb0ef41Sopenharmony_ci  Buffer.from('\u039a\u0391abc\u03a3\u03a3\u0395', 'ucs2');
1521cb0ef41Sopenharmony_ciassert(mixedByteStringUcs2.includes('bc', 0, 'ucs2'));
1531cb0ef41Sopenharmony_ciassert(mixedByteStringUcs2.includes('\u03a3', 0, 'ucs2'));
1541cb0ef41Sopenharmony_ciassert(!mixedByteStringUcs2.includes('\u0396', 0, 'ucs2'));
1551cb0ef41Sopenharmony_ci
1561cb0ef41Sopenharmony_ciassert.ok(
1571cb0ef41Sopenharmony_ci  mixedByteStringUcs2.includes(Buffer.from('bc', 'ucs2'), 0, 'ucs2'));
1581cb0ef41Sopenharmony_ciassert.ok(
1591cb0ef41Sopenharmony_ci  mixedByteStringUcs2.includes(Buffer.from('\u03a3', 'ucs2'), 0, 'ucs2'));
1601cb0ef41Sopenharmony_ciassert.ok(
1611cb0ef41Sopenharmony_ci  !mixedByteStringUcs2.includes(Buffer.from('\u0396', 'ucs2'), 0, 'ucs2'));
1621cb0ef41Sopenharmony_ci
1631cb0ef41Sopenharmony_citwoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2');
1641cb0ef41Sopenharmony_ci
1651cb0ef41Sopenharmony_ci// Test single char pattern
1661cb0ef41Sopenharmony_ciassert(twoByteString.includes('\u039a', 0, 'ucs2'));
1671cb0ef41Sopenharmony_ciassert(twoByteString.includes('\u0391', 0, 'ucs2'), 'Alpha');
1681cb0ef41Sopenharmony_ciassert(twoByteString.includes('\u03a3', 0, 'ucs2'), 'First Sigma');
1691cb0ef41Sopenharmony_ciassert(twoByteString.includes('\u03a3', 6, 'ucs2'), 'Second Sigma');
1701cb0ef41Sopenharmony_ciassert(twoByteString.includes('\u0395', 0, 'ucs2'), 'Epsilon');
1711cb0ef41Sopenharmony_ciassert(!twoByteString.includes('\u0392', 0, 'ucs2'), 'Not beta');
1721cb0ef41Sopenharmony_ci
1731cb0ef41Sopenharmony_ci// Test multi-char pattern
1741cb0ef41Sopenharmony_ciassert(twoByteString.includes('\u039a\u0391', 0, 'ucs2'), 'Lambda Alpha');
1751cb0ef41Sopenharmony_ciassert(twoByteString.includes('\u0391\u03a3', 0, 'ucs2'), 'Alpha Sigma');
1761cb0ef41Sopenharmony_ciassert(twoByteString.includes('\u03a3\u03a3', 0, 'ucs2'), 'Sigma Sigma');
1771cb0ef41Sopenharmony_ciassert(twoByteString.includes('\u03a3\u0395', 0, 'ucs2'), 'Sigma Epsilon');
1781cb0ef41Sopenharmony_ci
1791cb0ef41Sopenharmony_ciconst mixedByteStringUtf8 = Buffer.from('\u039a\u0391abc\u03a3\u03a3\u0395');
1801cb0ef41Sopenharmony_ciassert(mixedByteStringUtf8.includes('bc'));
1811cb0ef41Sopenharmony_ciassert(mixedByteStringUtf8.includes('bc', 5));
1821cb0ef41Sopenharmony_ciassert(mixedByteStringUtf8.includes('bc', -8));
1831cb0ef41Sopenharmony_ciassert(mixedByteStringUtf8.includes('\u03a3'));
1841cb0ef41Sopenharmony_ciassert(!mixedByteStringUtf8.includes('\u0396'));
1851cb0ef41Sopenharmony_ci
1861cb0ef41Sopenharmony_ci
1871cb0ef41Sopenharmony_ci// Test complex string includes algorithms. Only trigger for long strings.
1881cb0ef41Sopenharmony_ci// Long string that isn't a simple repeat of a shorter string.
1891cb0ef41Sopenharmony_cilet longString = 'A';
1901cb0ef41Sopenharmony_cifor (let i = 66; i < 76; i++) {  // from 'B' to 'K'
1911cb0ef41Sopenharmony_ci  longString = longString + String.fromCharCode(i) + longString;
1921cb0ef41Sopenharmony_ci}
1931cb0ef41Sopenharmony_ci
1941cb0ef41Sopenharmony_ciconst longBufferString = Buffer.from(longString);
1951cb0ef41Sopenharmony_ci
1961cb0ef41Sopenharmony_ci// Pattern of 15 chars, repeated every 16 chars in long
1971cb0ef41Sopenharmony_cilet pattern = 'ABACABADABACABA';
1981cb0ef41Sopenharmony_cifor (let i = 0; i < longBufferString.length - pattern.length; i += 7) {
1991cb0ef41Sopenharmony_ci  const includes = longBufferString.includes(pattern, i);
2001cb0ef41Sopenharmony_ci  assert(includes, `Long ABACABA...-string at index ${i}`);
2011cb0ef41Sopenharmony_ci}
2021cb0ef41Sopenharmony_ciassert(longBufferString.includes('AJABACA'), 'Long AJABACA, First J');
2031cb0ef41Sopenharmony_ciassert(longBufferString.includes('AJABACA', 511), 'Long AJABACA, Second J');
2041cb0ef41Sopenharmony_ci
2051cb0ef41Sopenharmony_cipattern = 'JABACABADABACABA';
2061cb0ef41Sopenharmony_ciassert(longBufferString.includes(pattern), 'Long JABACABA..., First J');
2071cb0ef41Sopenharmony_ciassert(longBufferString.includes(pattern, 512), 'Long JABACABA..., Second J');
2081cb0ef41Sopenharmony_ci
2091cb0ef41Sopenharmony_ci// Search for a non-ASCII string in a pure ASCII string.
2101cb0ef41Sopenharmony_ciconst asciiString = Buffer.from(
2111cb0ef41Sopenharmony_ci  'arglebargleglopglyfarglebargleglopglyfarglebargleglopglyf');
2121cb0ef41Sopenharmony_ciassert(!asciiString.includes('\x2061'));
2131cb0ef41Sopenharmony_ciassert(asciiString.includes('leb', 0));
2141cb0ef41Sopenharmony_ci
2151cb0ef41Sopenharmony_ci// Search in string containing many non-ASCII chars.
2161cb0ef41Sopenharmony_ciconst allCodePoints = [];
2171cb0ef41Sopenharmony_cifor (let i = 0; i < 65534; i++) allCodePoints[i] = i;
2181cb0ef41Sopenharmony_ciconst allCharsString = String.fromCharCode.apply(String, allCodePoints) +
2191cb0ef41Sopenharmony_ci    String.fromCharCode(65534, 65535);
2201cb0ef41Sopenharmony_ciconst allCharsBufferUtf8 = Buffer.from(allCharsString);
2211cb0ef41Sopenharmony_ciconst allCharsBufferUcs2 = Buffer.from(allCharsString, 'ucs2');
2221cb0ef41Sopenharmony_ci
2231cb0ef41Sopenharmony_ci// Search for string long enough to trigger complex search with ASCII pattern
2241cb0ef41Sopenharmony_ci// and UC16 subject.
2251cb0ef41Sopenharmony_ciassert(!allCharsBufferUtf8.includes('notfound'));
2261cb0ef41Sopenharmony_ciassert(!allCharsBufferUcs2.includes('notfound'));
2271cb0ef41Sopenharmony_ci
2281cb0ef41Sopenharmony_ci// Find substrings in Utf8.
2291cb0ef41Sopenharmony_cilet lengths = [1, 3, 15];  // Single char, simple and complex.
2301cb0ef41Sopenharmony_cilet indices = [0x5, 0x60, 0x400, 0x680, 0x7ee, 0xFF02, 0x16610, 0x2f77b];
2311cb0ef41Sopenharmony_cifor (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) {
2321cb0ef41Sopenharmony_ci  for (let i = 0; i < indices.length; i++) {
2331cb0ef41Sopenharmony_ci    const index = indices[i];
2341cb0ef41Sopenharmony_ci    let length = lengths[lengthIndex];
2351cb0ef41Sopenharmony_ci
2361cb0ef41Sopenharmony_ci    if (index + length > 0x7F) {
2371cb0ef41Sopenharmony_ci      length = 2 * length;
2381cb0ef41Sopenharmony_ci    }
2391cb0ef41Sopenharmony_ci
2401cb0ef41Sopenharmony_ci    if (index + length > 0x7FF) {
2411cb0ef41Sopenharmony_ci      length = 3 * length;
2421cb0ef41Sopenharmony_ci    }
2431cb0ef41Sopenharmony_ci
2441cb0ef41Sopenharmony_ci    if (index + length > 0xFFFF) {
2451cb0ef41Sopenharmony_ci      length = 4 * length;
2461cb0ef41Sopenharmony_ci    }
2471cb0ef41Sopenharmony_ci
2481cb0ef41Sopenharmony_ci    const patternBufferUtf8 = allCharsBufferUtf8.slice(index, index + length);
2491cb0ef41Sopenharmony_ci    assert(index, allCharsBufferUtf8.includes(patternBufferUtf8));
2501cb0ef41Sopenharmony_ci
2511cb0ef41Sopenharmony_ci    const patternStringUtf8 = patternBufferUtf8.toString();
2521cb0ef41Sopenharmony_ci    assert(index, allCharsBufferUtf8.includes(patternStringUtf8));
2531cb0ef41Sopenharmony_ci  }
2541cb0ef41Sopenharmony_ci}
2551cb0ef41Sopenharmony_ci
2561cb0ef41Sopenharmony_ci// Find substrings in Usc2.
2571cb0ef41Sopenharmony_cilengths = [2, 4, 16];  // Single char, simple and complex.
2581cb0ef41Sopenharmony_ciindices = [0x5, 0x65, 0x105, 0x205, 0x285, 0x2005, 0x2085, 0xfff0];
2591cb0ef41Sopenharmony_cifor (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) {
2601cb0ef41Sopenharmony_ci  for (let i = 0; i < indices.length; i++) {
2611cb0ef41Sopenharmony_ci    const index = indices[i] * 2;
2621cb0ef41Sopenharmony_ci    const length = lengths[lengthIndex];
2631cb0ef41Sopenharmony_ci
2641cb0ef41Sopenharmony_ci    const patternBufferUcs2 =
2651cb0ef41Sopenharmony_ci      allCharsBufferUcs2.slice(index, index + length);
2661cb0ef41Sopenharmony_ci    assert.ok(
2671cb0ef41Sopenharmony_ci      allCharsBufferUcs2.includes(patternBufferUcs2, 0, 'ucs2'));
2681cb0ef41Sopenharmony_ci
2691cb0ef41Sopenharmony_ci    const patternStringUcs2 = patternBufferUcs2.toString('ucs2');
2701cb0ef41Sopenharmony_ci    assert.ok(
2711cb0ef41Sopenharmony_ci      allCharsBufferUcs2.includes(patternStringUcs2, 0, 'ucs2'));
2721cb0ef41Sopenharmony_ci  }
2731cb0ef41Sopenharmony_ci}
2741cb0ef41Sopenharmony_ci
2751cb0ef41Sopenharmony_ci[
2761cb0ef41Sopenharmony_ci  () => { },
2771cb0ef41Sopenharmony_ci  {},
2781cb0ef41Sopenharmony_ci  [],
2791cb0ef41Sopenharmony_ci].forEach((val) => {
2801cb0ef41Sopenharmony_ci  assert.throws(
2811cb0ef41Sopenharmony_ci    () => b.includes(val),
2821cb0ef41Sopenharmony_ci    {
2831cb0ef41Sopenharmony_ci      code: 'ERR_INVALID_ARG_TYPE',
2841cb0ef41Sopenharmony_ci      name: 'TypeError',
2851cb0ef41Sopenharmony_ci      message: 'The "value" argument must be one of type number or string ' +
2861cb0ef41Sopenharmony_ci               'or an instance of Buffer or Uint8Array.' +
2871cb0ef41Sopenharmony_ci               common.invalidArgTypeHelper(val)
2881cb0ef41Sopenharmony_ci    }
2891cb0ef41Sopenharmony_ci  );
2901cb0ef41Sopenharmony_ci});
2911cb0ef41Sopenharmony_ci
2921cb0ef41Sopenharmony_ci// Test truncation of Number arguments to uint8
2931cb0ef41Sopenharmony_ci{
2941cb0ef41Sopenharmony_ci  const buf = Buffer.from('this is a test');
2951cb0ef41Sopenharmony_ci  assert.ok(buf.includes(0x6973));
2961cb0ef41Sopenharmony_ci  assert.ok(buf.includes(0x697320));
2971cb0ef41Sopenharmony_ci  assert.ok(buf.includes(0x69732069));
2981cb0ef41Sopenharmony_ci  assert.ok(buf.includes(0x697374657374));
2991cb0ef41Sopenharmony_ci  assert.ok(buf.includes(0x69737374));
3001cb0ef41Sopenharmony_ci  assert.ok(buf.includes(0x69737465));
3011cb0ef41Sopenharmony_ci  assert.ok(buf.includes(0x69737465));
3021cb0ef41Sopenharmony_ci  assert.ok(buf.includes(-140));
3031cb0ef41Sopenharmony_ci  assert.ok(buf.includes(-152));
3041cb0ef41Sopenharmony_ci  assert.ok(!buf.includes(0xff));
3051cb0ef41Sopenharmony_ci  assert.ok(!buf.includes(0xffff));
3061cb0ef41Sopenharmony_ci}
307