File: test

package info (click to toggle)
lie 2.2.2%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch, wheezy
  • size: 1,000 kB
  • ctags: 1,801
  • sloc: ansic: 12,761; yacc: 395; makefile: 150; sh: 4
file content (88 lines) | stat: -rw-r--r-- 2,155 bytes parent folder | download | duplicates (5)
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
y=1
f(int x)=x=x+1;y=5
x=10
f(1)
if y==5 then print("1 Okay") fi
if x==10 then print("2 Okay") fi

x=[1,2]
y=x
y[2]=3
if x==[1,2] then print("3 Okay") fi
if y==[1,3] then print("4 Okay") fi

f(vec x)=x[2]=100;if x==[1,100] then \
print("5 Okay") fi
y=[1,2]
f(y)
if y==[1,2] then print("6 Okay") fi

i=100
x=99
for i=1 to 10 do if i==5 then x=25 fi od
if i==100 then print("7 Okay") fi
if x==25 then print("8 Okay") fi

f() = for i=1 to 10 do if i==5 then loc x=75 fi od;\
if x==99 then print("9 Okay") fi
x=99
f()
if x==99 then print("10 Okay") fi

if for i=1 to 1 do i od == 1 then print("11 Okay") else\
print("11 False") fi

a=0
for i=1 to 10 do if i==5 then a=i fi od;\
if a==5 then print("12 Okay") else print("12 false") fi 

#k=7
#l=0
#l = for i=1 to k do i od
#if (nref(k)==1 && nref(l)==1 && l==k) then \
#print("13 Okay") else print("13 false") fi

y=[2,3]
g()=if y==10 then print("14 Okay") else print("14 false") fi
f(int y)=g()
f(10)

#g()=if nref(3) == 1 then print("15 Okay") else print("15 false");print(nref(3)) fi
#g

if {loc m=null(0,2);for i=1 to 2 do for j=1 to 2 do m=m+[i,j] od od;m} \
== [[1,1],[1,2],[2,1],[2,2]] \
then  print("16 Okay") \
else print("16 false") fi

k=0;if for i=1 to 10 do \
    i=1;k=k+1; \
    if k==3 then break(i)  \
	    else i fi od\
==1 then print("17 Okay") else print("17 false") fi

f()=loc x = [1,2];x
g()=loc x=3;f
if g == [1,2] then print("18 Okay") else print("18 false") fi

f(int x)=loc x=x+1;x
if f(3)==4 then print("19 Okay") else print("19 false") fi

q(int x)=if x>1 then loc c=q(x-1)+1;c else 1 fi
if q(2)==2 then print("20 Okay") else print("20 false") fi

f(int x)=if x!=0 then  return 1 + f(x-1) fi;1
g(int x)=if x==0 then  return 1 fi; 1 + g(x-1)
h(int x)=if x==0 then 1 else 1 + h(x-1) fi
if f(3)==4 then print("21 Okay") else print("21 false") fi
if g(3)==4 then print("22 Okay") else print("22 false") fi
if h(3)==4 then print("23 Okay") else print("23 false") fi

f()=p[1]=7;p
g()=p[2]=3;p
p=[0,0]
p= f()+g() 
if p == [14,3] then print("24 Okay") else print ("24 False") fi 

f(int x)=loc a=1;if x==0 then a = f(x-1) fi;a
if (f(3)==1) then print("25 Okay") else print("25 False") fi