Sha256: 4c022787762c8871e8b8b3f4f11ecc3ed510b7b3b16b5e8fe6706bed39a9bb1b

Contents?: true

Size: 540 Bytes

Versions: 72

Compression:

Stored size: 540 Bytes

Contents

'use strict';
var Buffer = require('../../').Buffer;



var assert = require('assert');

var safe = Buffer.alloc(10);

function isZeroFilled(buf) {
  for (var n = 0; n < buf.length; n++)
    if (buf[n] !== 0) return false;
  return true;
}

assert(isZeroFilled(safe));

// Test that unsafe allocations doesn't affect subsequent safe allocations
Buffer.allocUnsafe(10);
assert(isZeroFilled(new Float64Array(10)));

new Buffer(10);
assert(isZeroFilled(new Float64Array(10)));

Buffer.allocUnsafe(10);
assert(isZeroFilled(Buffer.alloc(10)));

Version data entries

72 entries across 71 versions & 15 rubygems

Version Path
ilog-0.4.0 node_modules/buffer/test/node/test-buffer-safe-unsafe.js
ilog-0.3.3 node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.8.7 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.8.6 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
jester-data-8.0.0 node_modules/buffer/test/node/test-buffer-safe-unsafe.js
ezii-os-5.2.1 node_modules/buffer/test/node/test-buffer-safe-unsafe.js
ezii-os-2.0.1 node_modules/buffer/test/node/test-buffer-safe-unsafe.js
ezii-os-1.1.0 node_modules/buffer/test/node/test-buffer-safe-unsafe.js
ezii-os-1.0.0 node_modules/buffer/test/node/test-buffer-safe-unsafe.js
ezii-os-0.0.0.1.0 node_modules/buffer/test/node/test-buffer-safe-unsafe.js
ezii-os-0.0.0.0.1 node_modules/buffer/test/node/test-buffer-safe-unsafe.js
optimacms-0.4.3 spec/dummy/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
optimacms-0.4.2 spec/dummy/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.8.4 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
locomotivecms-3.4.0 app/javascript/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
cortex-0.1.3 spec/dummy/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.8.3 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.8.2 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.8.1 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js