Sha256: 7afe0281328032b7f3fb46d772d2aa47fed9240e499d98b2c36c6e72084b64a2

Contents?: true

Size: 1.14 KB

Versions: 43

Compression:

Stored size: 1.14 KB

Contents

if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
var B = require('../').Buffer
var test = require('tape')

test('write/read Infinity as a float', function (t) {
  var buf = new B(4)
  t.equal(buf.writeFloatBE(Infinity, 0), 4)
  t.equal(buf.readFloatBE(0), Infinity)
  t.end()
})

test('write/read -Infinity as a float', function (t) {
  var buf = new B(4)
  t.equal(buf.writeFloatBE(-Infinity, 0), 4)
  t.equal(buf.readFloatBE(0), -Infinity)
  t.end()
})

test('write/read Infinity as a double', function (t) {
  var buf = new B(8)
  t.equal(buf.writeDoubleBE(Infinity, 0), 8)
  t.equal(buf.readDoubleBE(0), Infinity)
  t.end()
})

test('write/read -Infinity as a double', function (t) {
  var buf = new B(8)
  t.equal(buf.writeDoubleBE(-Infinity, 0), 8)
  t.equal(buf.readDoubleBE(0), -Infinity)
  t.end()
})

test('write/read float greater than max', function (t) {
  var buf = new B(4)
  t.equal(buf.writeFloatBE(4e38, 0), 4)
  t.equal(buf.readFloatBE(0), Infinity)
  t.end()
})

test('write/read float less than min', function (t) {
  var buf = new B(4)
  t.equal(buf.writeFloatBE(-4e40, 0), 4)
  t.equal(buf.readFloatBE(0), -Infinity)
  t.end()
})

Version data entries

43 entries across 42 versions & 15 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/buffer/test/write_infinity.js
disco_app-0.18.0 test/dummy/node_modules/buffer/test/write_infinity.js
disco_app-0.18.2 test/dummy/node_modules/buffer/test/write_infinity.js
disco_app-0.16.1 test/dummy/node_modules/buffer/test/write_infinity.js
disco_app-0.15.2 test/dummy/node_modules/buffer/test/write_infinity.js
disco_app-0.18.4 test/dummy/node_modules/buffer/test/write_infinity.js
disco_app-0.18.1 test/dummy/node_modules/buffer/test/write_infinity.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/buffer/test/write_infinity.js
disco_app-0.14.0 test/dummy/node_modules/buffer/test/write_infinity.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/buffer/test/write_infinity.js
tang-0.2.1 spec/tang_app/node_modules/buffer/test/write_infinity.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/buffer/test/write_infinity.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/buffer/test/write_infinity.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/buffer/test/write_infinity.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/buffer/test/write_infinity.js
tang-0.2.0 spec/tang_app/node_modules/buffer/test/write_infinity.js
tang-0.1.0 spec/tang_app/node_modules/buffer/test/write_infinity.js
tang-0.0.9 spec/tang_app/node_modules/buffer/test/write_infinity.js
enju_library-0.3.8 spec/dummy/node_modules/buffer/test/write_infinity.js
ilog-0.4.1 node_modules/buffer/test/write_infinity.js