Skip to content

Commit 55be598

Browse files
committed
complete coverage 100%
1 parent bf5e733 commit 55be598

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lab3/main_test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,21 @@ const assert = require('assert');
33
const { Calculator } = require('./main');
44

55
// TODO: write your tests here
6+
describe('Calculator', () => {
7+
it('should calculate exp correctly', () => {
8+
const calculator = new Calculator();
9+
const infiniteValue = Infinity;
10+
assert.throws(() => calculator.exp(infiniteValue), Error);
11+
assert.throws(() => calculator.exp(Number.MAX_VALUE), Error);
12+
assert.strictEqual(calculator.exp(1), Math.exp(1));
13+
});
14+
15+
it('should calculate log correctly', () => {
16+
const calculator = new Calculator();
17+
const infiniteValue = Infinity;
18+
assert.throws(() => calculator.log(infiniteValue), Error);
19+
assert.strictEqual(calculator.log(2), Math.log(2));
20+
assert.throws(() => calculator.log(0), Error);
21+
assert.throws(() => calculator.log(-1), Error);
22+
});
23+
});

0 commit comments

Comments
 (0)