-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestCases.tiny
71 lines (63 loc) · 1.93 KB
/
TestCases.tiny
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
64
65
66
67
68
69
70
71
/* TEST CASE 1 */
/* datatype, function dec, function call, parameters, assignment, declaration, write, read, conditions,
main func, return, expressions, equations, boolean ops */
int sum(int a, int b)
{
return a + b;
}
int main()
{
int val, counter;
read val;
counter := 0;
repeat
val := val - 1;
write "Iteration number [";
write counter;
write "] the value of x = ";
write val;
write endl;
counter := counter+1;
until val = 1
write endl;
string s := "number of Iterations = ";
write s;
counter := counter-1;
write counter;
/* complicated equation */
float z1 := 3*2*(2+1)/2-5.3;
z1 := z1 + sum(a,y);
if z1 > 5 || z1 < counter && z1 = 1 then
write z1;
elseif z1 < 5 then
z1 := 5;
else
z1 := counter;
end
return 0;
}
/* _____________________________________________________ */
/* TEST CASE 2 */
/* complicated func call, equations, expressions, return, main, datatype */
int main()
{
int x := fun(d(c, 3*2*(2+1)/2-5.3), ee, f(2, d, 6, 5 + 5));
return 0;
}
/* _____________________________________________________ */
/* TEST CASE 3 */
/* datatype, main, comments, conditions, loops, loop condition, return, read, assignment, declration */
int main()
{
int x;
read x; /*input an integer*/
if x > 0 then /*don’t compute if x <= 0 */
int fact := 1;
repeat
fact := fact * x;
x := x - 1;
until x = 0
write fact; /*output factorial of x*/
end
return 0;
}