xref: /third_party/node/test/parallel/test-buffer-zero-fill-reset.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_cirequire('../common');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_cifunction testUint8Array(ui) {
81cb0ef41Sopenharmony_ci  const length = ui.length;
91cb0ef41Sopenharmony_ci  for (let i = 0; i < length; i++)
101cb0ef41Sopenharmony_ci    if (ui[i] !== 0) return false;
111cb0ef41Sopenharmony_ci  return true;
121cb0ef41Sopenharmony_ci}
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_cifor (let i = 0; i < 100; i++) {
161cb0ef41Sopenharmony_ci  Buffer.alloc(0);
171cb0ef41Sopenharmony_ci  const ui = new Uint8Array(65);
181cb0ef41Sopenharmony_ci  assert.ok(testUint8Array(ui), `Uint8Array is not zero-filled: ${ui}`);
191cb0ef41Sopenharmony_ci}
20

Indexes created Thu Nov 07 10:32:03 CST 2024