-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test.ts
63 lines (49 loc) · 1.61 KB
/
index.test.ts
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import * as optn from "./index";
test("Make addition operation", () => {
const op = optn.operations.ADDITION;
expect(op.operate(3, 3)).toBe(6);
});
test("Make substraction operation", () => {
const op = optn.operations.SUBSTRACTION;
expect(op.operate(3, 3)).toBe(0);
});
test("Make multiplication operation", () => {
const op = optn.operations.MULTIPLICATION;
expect(op.operate(3, 3)).toBe(9);
});
test("Make division operation", () => {
const op = optn.operations.DIVISION;
expect(op.operate(3, 3)).toBe(1);
});
test("Make remainder operation", () => {
const op = optn.operations.REMAINDER;
expect(op.operate(3, 3)).toBe(0);
});
test("Make exponentiation operation", () => {
const op = optn.operations.EXPONENTIATION;
expect(op.operate(3, 3)).toBe(27);
});
test("Make increment operation", () => {
const op = optn.operations.INCREMENT;
expect(op.operate(3)).toBe(4);
});
test("Make decrement operation", () => {
const op = optn.operations.DECREMENT;
expect(op.operate(3)).toBe(2);
});
test("Make unary negation operation. Positive to negative.", () => {
const op = optn.operations.UNARY_NEGATION;
expect(op.operate(3)).toBe(-3);
});
test("Make unary negation operation. Negative to posivite.", () => {
const op = optn.operations.UNARY_NEGATION;
expect(op.operate(-3)).toBe(3);
});
test("Make unary plus operation. Positive.", () => {
const op = optn.operations.UNARY_PLUS;
expect(op.operate(3)).toBe(3);
});
test("Make unary plus operation. Negative", () => {
const op = optn.operations.UNARY_PLUS;
expect(op.operate(-3)).toBe(-3);
});