Sha256: 3ca5782f585dfaecef106f0d4a1791b4f0c2a72ee234fb54e561f34833f35be4

Contents?: true

Size: 1.08 KB

Versions: 35

Compression:

Stored size: 1.08 KB

Contents

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

35 entries across 35 versions & 1 rubygems

Version Path
sumomo-0.10.8 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.10.4 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.10.3 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.10.2 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.10.1 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.10.0 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.9.0 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.8.22 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.8.21 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.8.20 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.8.17 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.8.16 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.8.15 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.8.14 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.8.13 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.8.12 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.8.11 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.8.10 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.8.9 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js
sumomo-0.8.8 data/sumomo/api_modules/node_modules/buffer/test/write_infinity.js