tests: add calc tests
[m6w6/ext-psi] / tests / calc / calc.psi
1 function test\calc1() : array {
2 let numerator = 3 * 5 + 2;
3 let denominator = 17;
4 return to_array(div,
5 to_int(quot),
6 to_int(rem)
7 );
8 }
9
10 function test\calc2() : array {
11 let numerator = 4 + 5 * 2;
12 let denominator = 14;
13 return to_array(div,
14 to_int(quot),
15 to_int(rem)
16 );
17 }
18
19 function test\calc3() : array {
20 let numerator = -1 + 2 - 3 * 2;
21 let denominator = -5;
22 return to_array(div,
23 to_int(quot),
24 to_int(rem)
25 );
26 }
27
28 function test\calc4() : array {
29 let numerator = 1 * 5 / 5 * -1 / -1 * 10 / 5 + 4 * 2;
30 let denominator = 10;
31 return to_array(div,
32 to_int(quot),
33 to_int(rem)
34 );
35 }
36
37 function test\calc5() : array {
38 let numerator = 5 % 3;
39 let denominator = 2;
40 return to_array(div,
41 to_int(quot),
42 to_int(rem)
43 );
44 }
45
46 function test\calc6() : array {
47 let numerator = 5 % 3 + 1;
48 let denominator = 3;
49 return to_array(div,
50 to_int(quot),
51 to_int(rem)
52 );
53 }
54
55 function test\calc7() : array {
56 let numerator = 5 % (3 + 1);
57 let denominator = 1;
58 return to_array(div,
59 to_int(quot),
60 to_int(rem)
61 );
62 }