1'use strict'; 2 3require('../common'); 4const assert = require('assert'); 5 6const safe = Buffer.alloc(10); 7 8function isZeroFilled(buf) { 9 for (let n = 0; n < buf.length; n++) 10 if (buf[n] !== 0) return false; 11 return true; 12} 13 14assert(isZeroFilled(safe)); 15 16// Test that unsafe allocations doesn't affect subsequent safe allocations 17Buffer.allocUnsafe(10); 18assert(isZeroFilled(new Float64Array(10))); 19 20new Buffer(10); 21assert(isZeroFilled(new Float64Array(10))); 22 23Buffer.allocUnsafe(10); 24assert(isZeroFilled(Buffer.alloc(10))); 25