-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.pl
121 lines (66 loc) · 3.73 KB
/
tests.pl
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
s(Tree,[r, u, n, =, 2, *, r, u, n, +, 1, ;],[]). %True
s(Tree,[r, u, n,'1', =, 2, *, r, u, n, +, 1, ;],[]). %True
s(Tree,['_',r, u, n, =, 2, *, r, u, n, +, 1, ;],[]). %True
s(Tree,['1' ,=, 2, *, r, u, n, +, 1, ;],[]). %false
boolean(Tree,['(' , 'C', o, m, p, i, l, e, r, >, o, t, h, e, r, s, ')'],[]). %False
boolean(Tree,['C', o, m, p, i, l, e, r, >, o, t, h, e, r, s],[]). %True
boolean(Tree,[r, u, n, <=, w, -, 1],[]). %True
boolean(Tree,[r, u, n, <=, '_',w, -, 1],[]). %True
s(T, [if, '(' , 'C', o, m, p, i, l, e, r, >, o, t, h, e, r, s, ')', a, l, l, =, 1, ;], []). %True
s(T,[if, '(', 'T', o, t, a, l, <, 500, ')', 'T', o, t, a, l, =, 'T', o, t, a, l, +, 150, ;, else, if, '(', x, '!=', 'T', o, t, a, l, ')', 'T', o, t, a, l, =, 0, ;, else, x, =, 55, /, y, -, 15, ;],[]). %True
s(T, [if, '(', x, >, 0, ')', x, =, x, -, 1], []). %False
s(T, [v, =, 23, *, s, a, l, +, 1, a, z, ;], []). %False
s(T, [x, =, z, ;, if, '(', x, >, y, ')', x, '_', n, e, w, =, z, ;, else, x, '_', n, e, w, =, y, ;, else, y, =, z, ;], []). %False
s(T, [while,'(',r, u, n, <=, w, -, 1, ')', r, u, n, =, 2, *, r, u, n, +, 1, ;], []). %True
s(T,[r, u, n,=,0,;,while,'(',r, u, n, <=, w, -, 1, ')', r, u, n, =, 2, *, r, u, n, +, 1, ;],[]). %True
s(T, [while,'(',r, u, n, <=, w, -, 1, ')', r, u, n, =, 2, *, r, u, n, +, 1, ;,if, '(' , 'C', o, m, p, i, l, e, r, >, o, t, h, e, r, s, ')', a, l, l, =, 1, ;], []). %True
s(T, ['$','$','a', =, 1,+,2, ;] ,[]). %True
% TESTS
% SHOULD ACCEPT
s(T, [if,'(',a,<,z,')',b,=,w,;,else,m,=,1,;] ,[]).
% if(a<z)b=w;elsem=1;
s(T, [while,'(',1,>,2,')',z,=,3,;,a,=,b,;] ,[]).
% while(1>2)z=3;a=b;
s(T, [while,'(',1,>,2,')',z,=,3,;,a,=,b,;,if,'(',a,<,z,')',b,=,w,;,else,m,=,1,;] ,[]).
% while(1>2)z=3;a=b;if(a<z)b=w;else m=1;
s(T, [while,'(',1,>,2,')',z,=,3,;,a,=,b,;,if,'(',a,<,z,')',b,=,w,;] ,[]).
% while(1>2)z=3;a=b;if(a<z)b=w;
s(T, ['_','a','_', =, 1,+,2, ;] ,[]).
s(T, ['$','$','a', =, 1,+,2, ;] ,[]).
s(T, ['a','b','$','_', =, 1,+,2, ;] ,[]).
s(T, [c,o,u,n,t,e,r,1,=,c,o,u,n,t,e,r,1,+,'(',x,/,y,-,21,')','%','_',w,2,;], []).
% counter1 = counter1 + (x / y - 21) % _w2;
s(T, [c,o,u,n,t,e,r,=,x,+,y,;,while,'(',c,o,u,n,t,e,r,<=,w,-,1,')',while,'(',c,o,u,n,t,e,r,'!=',y,')',c,o,u,n,t,e,r,=,c,o,u,n,t,e,r,+,x,+,5,;,if,'(',c,o,u,n,t,e,r,>,w,+,2,')',if,'(',c,o,u,n,t,e,r,>,x,')',c,o,u,n,t,e,r,=,y,;,else,if,'(',c,o,u,n,t,e,r,>,y,')',c,o,u,n,t,e,r,=,x,;,w,=,y,/,x,;] ,[]).
% counter = x + y;
% while (counter <= w - 1)
% while (counter != y)
% counter = counter + x + 5;
% if (counter > w + 2)
% if (counter > x)
% counter = y;
% else
% if (counter > y)
% counter = x;
% w = y / x;
s(T, [r,u,n,=,0,;,while,'(',r,u,n,<=,w,-,1,')',r,u,n,=,2,*,r,u,n,+,1,;] ,[]).
% % run=0;while(run<=w-1)run=2*run+1;
s(T, [c,o,u,n,t,e,r,1,=,c,o,u,n,t,e,r,1,+,'(',x,/,y,-,21,')','%','_',w,2,;], []).
s(T, [if,'(','C',o,m,p,i,l,e,r,>,o,t,h,e,r,s,')',a,l,l,=,1,;] ,[]).
% % if(Compiler>others)all=1;
s(T, [while,'(',r,u,n,<=,w,-,1,')',r,u,n,=,2,*,r,u,n,+,1,;] ,[]).
% % while(run<=w-1)run=2*run+1;
s(T, [if,'(','T',o,t,a,l,<,500,')','T',o,t,a,l,=,'T',o,t,a,l,+,150,;,else,if,'(',x,'!=','T',o,t,a,l,')','T',o,t,a,l,=,0,;,else,x,=,55,/,y,-,15,;] ,[]).
% % if(Total<500)Total=Total+150;elseif(x!=Total)Total=0;elsex=55/y-15;
% % NOT ACCEPTED
s(T, [v,=,23,*,s,a,l,+,1,a,z,;], []).
% % v=23*sal+1az;
s(T, [x,=,z,;,if,'(',x,>,y,')',x,'_',n,e,w,=,z,;,else,x,'_',n,e,w,=,y,;,else,y,=,z,;] ,[]).
% % x=z;if(x>y)x_new=z;elsex_new=y;elsey=z;
s(T, [if,'(',x,>,0,')',x,=,x,-,1], []).
% % if(x>0)x=x-1
s(T, [c,o,u,n,t,e,r,1,=,1,c,o,u,n,t,e,r,+,+,x,/,y,-,21,')','%','_',w,2] ,[]).
% counter1 = 1counter ++x / y - 21) % _w2
s(T, [a, =, if, ;] ,[]).
s(T, ['a','b',';','_', =, 1,+,2, ;] ,[]).
s(T, ['a','b','!','_', =, 1,+,2, ;] ,[]).
s(T, [w,h,i,l,e,'(',1,>,2,')',z,=,3,;,a,=,b,;] ,[]).