c90749c0483ccf25702c591f74a5d91376ef4f54
[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 }
63
64 function test\calc8() : array {
65 let numerator = !0 + !0 + !0;
66 let denominator = 3;
67 return to_array(div,
68 to_int(quot),
69 to_int(rem)
70 );
71 }
72
73 function test\calc9() : array {
74 let numerator = 1 && 2;
75 let denominator = 1;
76 return to_array(div,
77 to_int(quot),
78 to_int(rem)
79 );
80 }
81
82 function test\calc10() : array {
83 let numerator = (1 | 2 | 4) & ~3;
84 let denominator = 4;
85 return to_array(div,
86 to_int(quot),
87 to_int(rem)
88 );
89 }
90
91 function test\calc11() : array {
92 let numerator = 1 + (1 + 1 < 2);
93 let denominator = 1;
94 return to_array(div,
95 to_int(quot),
96 to_int(rem)
97 );
98 }
99
100 function test\calc12() : array {
101 let numerator = 1 + (1 + 1 < 3);
102 let denominator = 2;
103 return to_array(div,
104 to_int(quot),
105 to_int(rem)
106 );
107 }