summaryrefslogtreecommitdiff
path: root/tests/test.int.js
blob: 954fd279f7c66b3b8a8adf02934f8d29a1f69289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* eslint-disable no-console */
const expect = chai.expect;

import { toUnsigned32bit, toSigned32bit } from '../core/util/int.js';

describe('Integer casting', function () {
    it('should cast unsigned to signed', function () {
        let expected = 4294967286;
        expect(toUnsigned32bit(-10)).to.equal(expected);
    });

    it('should cast signed to unsigned', function () {
        let expected = -10;
        expect(toSigned32bit(4294967286)).to.equal(expected);
    });
});