Skip to content

Commit

Permalink
chore: add test case for big number
Browse files Browse the repository at this point in the history
  • Loading branch information
peakchen90 committed May 20, 2021
1 parent 9eda71c commit d8c5496
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ describe('Evaluate', () => {
expect(evaluate('0.1 + 0.2')).toBe('0.3');
});

// big number
test('9007199254740992 + 1', () => {
expect(evaluate('9007199254740992 + 1')).toBe('9007199254740993');
});

test('0.3 - 0.1', () => {
expect(evaluate('0.3 - 0.1')).toBe('0.2');
});
Expand Down
1 change: 1 addition & 0 deletions test/pure.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {IAdapter} from '../src/transform';
describe('Pure', () => {
test('evaluate with default adapter', () => {
expect(evaluate('0.1 + 0.2')).toBe('0.30000000000000004');
expect(evaluate('9007199254740992 + 1')).toBe('9007199254740992');
expect(evaluate('3 - 5')).toBe('-2');
expect(evaluate('2 * 4')).toBe('8');
expect(evaluate('20 / 2')).toBe('10');
Expand Down

0 comments on commit d8c5496

Please sign in to comment.