test.int.js 487 B

12345678910111213141516
  1. /* eslint-disable no-console */
  2. const expect = chai.expect;
  3. import { toUnsigned32bit, toSigned32bit } from '../core/util/int.js';
  4. describe('Integer casting', function () {
  5. it('should cast unsigned to signed', function () {
  6. let expected = 4294967286;
  7. expect(toUnsigned32bit(-10)).to.equal(expected);
  8. });
  9. it('should cast signed to unsigned', function () {
  10. let expected = -10;
  11. expect(toSigned32bit(4294967286)).to.equal(expected);
  12. });
  13. });