Sha256: 4f08c72c4de256e0337a47a19a1358b63965a975fffef41f3a6f0895271624c5

Contents?: true

Size: 757 Bytes

Versions: 69

Compression:

Stored size: 757 Bytes

Contents

var binary = require('../');
var test = require('tap').test;

test('negls', function (t) {
    t.plan(4);
    // note: can't store -12667700813876161 exactly in an ieee float
    
    var buf = new Buffer([
        226, // a == -30
        219, 246, // b == -2341
        236, 245, 243, 255, // c == -789012
        63, 52, 222, 16, 203, 254, 210, 255, // d == -12667700813876161
    ]);
    
    binary.parse(buf)
        .word8ls('a')
        .word16ls('b')
        .word32ls('c')
        .word64ls('d')
        .tap(function (vars) {
            t.same(vars.a, -30);
            t.same(vars.b, -2341);
            t.same(vars.c, -789012);
            t.ok(
                Math.abs(vars.d - -12667700813876161) < 1000
            );
        })
    ;
});

Version data entries

69 entries across 69 versions & 2 rubygems

Version Path
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.18 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.17 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.16 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.15 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.14 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.13 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.12 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.11 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.10 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.9 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/decompress-zip/node_modules/binary/test/negls.js