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
sumomo-0.10.8 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
optimacms-0.1.61 spec/dummy/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.10.4 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.10.3 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.10.2 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.10.1 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.10.0 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.9.0 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.8.22 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.8.21 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.8.20 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.8.17 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.8.16 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
disco_app-0.18.0 test/dummy/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
disco_app-0.18.2 test/dummy/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.8.15 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
disco_app-0.16.1 test/dummy/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.8.14 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
sumomo-0.8.13 data/sumomo/api_modules/node_modules/buffer/test/node/test-buffer-safe-unsafe.js
disco_app-0.15.2 test/dummy/node_modules/buffer/test/node/test-buffer-safe-unsafe.js