gristlabs_grist-core/test/common/BigInt.ts
Jarosław Sadziński a52d56f613 (core) Moving client and common tests to core
Summary:
- Moved /test/client and /test/common to core.
- Moved two files (CircularArray and RecentItems) from app/common to core/app/common.
- Moved resetOrg test to gen-server.
- `testrun.sh` is now invoking common and client test from core.
- Added missing packages to core's package.json (and revealed underscore as it is used in the main app).
- Removed Coord.js as it is not used anywhere.

Test Plan: Existing tests

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D3590
2022-08-23 19:20:10 +02:00

22 lines
1021 B
TypeScript

import {BigInt} from 'app/common/BigInt';
import {assert} from 'chai';
import {times} from 'lodash';
describe('BigInt', function() {
it('should represent and convert various numbers correctly', function() {
assert.strictEqual(new BigInt(16, [0xF, 0xA], +1).toString(16), "af");
assert.strictEqual(new BigInt(16, [0xA, 0xF], -1).toString(16), "-fa");
assert.strictEqual(new BigInt(16, [0xF, 0xF], +1).toString(10), "255");
assert.strictEqual(new BigInt(16, [0xF, 0xF], -1).toString(10), "-255");
assert.strictEqual(new BigInt(10, times(20, () => 5), 1).toString(10), "55555555555555555555");
assert.strictEqual(new BigInt(100, times(20, () => 5), 1).toString(10),
"505050505050505050505050505050505050505");
assert.strictEqual(new BigInt(1000, times(20, () => 5), 1).toString(10),
"5005005005005005005005005005005005005005005005005005005005");
assert.strictEqual(new BigInt(0x10000, [0xABCD, 0x1234, 0xF0F0, 0x5678], -1).toString(16),
"-5678f0f01234abcd");
});
});