-
Notifications
You must be signed in to change notification settings - Fork 0
/
0-calcul.test.js
36 lines (28 loc) · 1.14 KB
/
0-calcul.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const assert = require('assert');
const calculateNumber = require('./0-calcul');
describe('calculateNumber', () => {
it('floating point whole numbers', () => {
assert.strictEqual(calculateNumber(1.0, 2.0), 3);
});
it('rounding down b\'s floating point fractional number', () => {
assert.strictEqual(calculateNumber(1.0, 2.4), 3);
});
it('rounding down a and b\'s floating point fractional number', () => {
assert.strictEqual(calculateNumber(1.4, 2.4), 3);
});
it('rounding down a\'s floating point fractional number', () => {
assert.strictEqual(calculateNumber(1.4, 2.0), 3);
});
it('rounding up b\'s floating point fractional numbers', () => {
assert.strictEqual(calculateNumber(1.0, 2.5), 4);
});
it('rounding up a and b\'s floating point fractional numbers', () => {
assert.strictEqual(calculateNumber(2.6, 2.5), 6);
});
it('rounding up a\'s floating point fractional numbers', () => {
assert.strictEqual(calculateNumber(2.6, 2.0), 5);
});
it('rounding down a and b floating point fractional numbers with trailing 9\'s', () => {
assert.strictEqual(calculateNumber(2.499999, 3.499999), 5);
});
});