Exemplo n.º 1
0
 "zero_sub_signed": function(test) {
     var longVal = Long.fromInt(0, true).add(Long.fromInt(-1, false));
     test.equal(longVal.low, -1);
     test.equal(longVal.high, -1);
     test.equal(longVal.unsigned, true);
     test.equal(longVal.toNumber(), 18446744073709551615);
     test.equal(longVal.toString(), "18446744073709551615");
     test.done();
 },
Exemplo n.º 2
0
 "max_unsigned_div_neg_signed": function(test) {
     var a = Long.MAX_UNSIGNED_VALUE;
     var b = Long.fromInt(-2);
     test.strictEqual(b.toUnsigned().toString(), Long.MAX_UNSIGNED_VALUE.sub(1).toString());
     var longVal = a.div(b);
     test.strictEqual(longVal.toString(), '1');
     test.done();
 },
Exemplo n.º 3
0
 "construct_negint": function(test) {
     var longVal = Long.fromInt(-1, true);
     test.equal(longVal.low, -1);
     test.equal(longVal.high, -1);
     test.equal(longVal.unsigned, true);
     test.equal(longVal.toNumber(), 18446744073709551615);
     test.equal(longVal.toString(), "18446744073709551615");
     test.done();
 },
Exemplo n.º 4
0
    "dispose": function(test) {
        if (!Long.dispose) {
            test.log("Not supported");
            test.done();
            return;
        }
        var inst = Long.fromInt(0);
        test.strictEqual(Long.dispose(inst), false); // cached, not reused
        Long.dispose(inst);
        var inst2 = Long.fromInt(1);
        test.notStrictEqual(inst, inst2);
        test.done();

        inst = Long.fromNumber(0);
        test.strictEqual(Long.dispose(inst), true); // not cached (our first inst is), reused
        inst2 = Long.fromNumber(1);
        test.strictEqual(inst, inst2);
        test.done();
    },
Exemplo n.º 5
0
 "max_unsigned_div_neg_signed": function(test) {
     var longVal = Long.MAX_UNSIGNED_VALUE.div(Long.fromInt(-2));
     test.equal(longVal.toNumber(), -Long.MAX_VALUE);
     test.done();
 },