diff --git a/tests/tbf0008.pp b/tests/tbf0008.pp new file mode 100644 index 0000000000..af7b850af8 --- /dev/null +++ b/tests/tbf0008.pp @@ -0,0 +1,6 @@ +const + compilerconst=1; + +begin + dec(compilerconst); +end. diff --git a/tests/tbf0010.pp b/tests/tbf0010.pp new file mode 100644 index 0000000000..bcca061be9 --- /dev/null +++ b/tests/tbf0010.pp @@ -0,0 +1,6 @@ +program hello; + + begin + writeln('Hello); + end. + diff --git a/tests/tbs0004.pp b/tests/tbs0004.pp new file mode 100644 index 0000000000..5cacec131b --- /dev/null +++ b/tests/tbs0004.pp @@ -0,0 +1,13 @@ +var + i : longint; + +begin + for i:=1 to 100 do + begin + writeln('Hello'); + continue; + writeln('ohh'); + Halt(1); + end; +end. + diff --git a/tests/tbs0005.pp b/tests/tbs0005.pp new file mode 100644 index 0000000000..5ac9921e6a --- /dev/null +++ b/tests/tbs0005.pp @@ -0,0 +1,10 @@ +begin + if 1=1 then + begin + Writeln('OK'); + end; + if 1<>1 then + begin + Halt(1); + end; +end. diff --git a/tests/tbs0006.pp b/tests/tbs0006.pp new file mode 100644 index 0000000000..95fb8cea7e --- /dev/null +++ b/tests/tbs0006.pp @@ -0,0 +1,16 @@ +var + a,b,c,d,e,f,g,r : double; + +begin + a:=10.0; + b:=11.0; + c:=13.0; + d:=17.0; + e:=19.0; + f:=23.0; + r:=2.0; + a:= a - 2*b*e - 2*c*f - 2*d*g - Sqr(r); + writeln(a,' (must be -1010)'); + if a<>-1010.0 then + Halt(1); +end. diff --git a/tests/tbs0007.pp b/tests/tbs0007.pp new file mode 100644 index 0000000000..60e065b881 --- /dev/null +++ b/tests/tbs0007.pp @@ -0,0 +1,14 @@ +var + count : byte; + test : longint; +begin + test:=0; + for count:=1 to 127 do + begin + inc(test); + writeln(count,'. loop'); + if test>127 then + Halt(1); + end; +end. + diff --git a/tests/tbs0009.pp b/tests/tbs0009.pp new file mode 100644 index 0000000000..85c4f65994 --- /dev/null +++ b/tests/tbs0009.pp @@ -0,0 +1,27 @@ +var c:byte; + + Procedure a(b:boolean); + + begin + if b then writeln('TRUE') else writeln('FALSE'); + end; + + function Test_a(b:boolean) : string; + + begin + if b then Test_a:='TRUE' else Test_a:='FALSE'; + end; + + begin {main program} + a(true); {works} + if Test_a(true)<>'TRUE' then halt(1); + a(false); {works} + if Test_a(false)<>'FALSE' then halt(1); + c:=0; + a(c>0); {doesn't work} + if Test_a(c>0)<>'FALSE' then halt(1); + a(c<0); {doesn't work} + if Test_a(c<0)<>'FALSE' then halt(1); + a(c=0); + if Test_a(c=0)<>'TRUE' then halt(1); + end. diff --git a/tests/tbs0011.pp b/tests/tbs0011.pp new file mode 100644 index 0000000000..ea2968b472 --- /dev/null +++ b/tests/tbs0011.pp @@ -0,0 +1,14 @@ +{$message don't know how to make a test from bug0011 (PM)} +var + vga : array[0..320*200-1] of byte; + +procedure test(x,y : longint); + + begin + vga[x+y mod 320]:=random(256); + vga[x+y mod 320]:=random(256); + end; + +begin +end. + diff --git a/tests/tbs0012.pp b/tests/tbs0012.pp new file mode 100644 index 0000000000..1ecc0f5a91 --- /dev/null +++ b/tests/tbs0012.pp @@ -0,0 +1,13 @@ +var + a,b : longint; + +begin + a:=1; + b:=2; + if byte(a>b)=byte(a1210.0 then halt(1); +end. diff --git a/tests/tbs0016.pp b/tests/tbs0016.pp new file mode 100644 index 0000000000..148ef70082 --- /dev/null +++ b/tests/tbs0016.pp @@ -0,0 +1,193 @@ + uses + crt; + + const + { ... parameters } + w = 10; { max. 10 } + h = 10; { max. 10 } + + type + tp = array[0..w,0..h] of double; + + var + temp : tp; + phi : tp; + Bi : tp; + + boundary : array[0..w,0..h] of double; + + function start_temp(i,j : longint) : double; + + begin + start_temp:=(boundary[i,0]*(h-j)+boundary[i,h]*j+boundary[0,j]*(w-i)+boundary[w,j]*i)/(w+h); + end; + + procedure init; + + var + i,j : longint; + + begin + for i:=0 to w do + for j:=0 to h do + temp[i,j]:=start_temp(i,j); + end; + + procedure draw; + + var + i,j : longint; + + begin + for i:=0 to w do + for j:=0 to h do + begin + textcolor(white); + gotoxy(i*7+1,j*2+1); + writeln(temp[i,j]:6:0); + textcolor(darkgray); + gotoxy(i*7+1,j*2+2); + writeln(phi[i,j]:6:3); + end; + end; + + procedure calc_phi; + + var + i,j : longint; + + begin + for i:=0 to w do + for j:=0 to h do + begin + if (i=0) and (j=0) then + begin + phi[i,j]:=Bi[i,j]*boundary[i,j]+0.5*temp[i,j+1]+0.5*temp[i+1,j]-(1+Bi[i,j])*temp[i,j]; + end + else if (i=0) and (j=h) then + begin + phi[i,j]:=Bi[i,j]*boundary[i,j]+0.5*temp[i,j-1]+0.5*temp[i+1,j]-(1+Bi[i,j])*temp[i,j]; + end + else if (i=w) and (j=0) then + begin + phi[i,j]:=Bi[i,j]*boundary[i,j]+0.5*temp[i,j+1]+0.5*temp[i-1,j]-(1+Bi[i,j])*temp[i,j]; + end + else if (i=w) and (j=h) then + begin + phi[i,j]:=Bi[i,j]*boundary[i,j]+0.5*temp[i,j-1]+0.5*temp[i-1,j]-(1+Bi[i,j])*temp[i,j]; + end + else if i=0 then + begin + phi[i,j]:=Bi[i,j]*boundary[i,j]+temp[i+1,j]+0.5*temp[i,j-1]+0.5*temp[i,j+1]-(2+Bi[i,j])*temp[i,j]; + end + else if i=w then + begin + phi[i,j]:=Bi[i,j]*boundary[i,j]+temp[i-1,j]+0.5*temp[i,j-1]+0.5*temp[i,j+1]-(2+Bi[i,j])*temp[i,j]; + end + else if j=0 then + begin + phi[i,j]:=Bi[i,j]*boundary[i,j]+temp[i,j+1]+0.5*temp[i-1,j]+0.5*temp[i+1,j]-(2+Bi[i,j])*temp[i,j]; + end + else if j=h then + begin + phi[i,j]:=Bi[i,j]*boundary[i,j]+temp[i,j-1]+0.5*temp[i-1,j]+0.5*temp[i+1,j]-(2+Bi[i,j])*temp[i,j]; + end + else + phi[i,j]:=temp[i,j-1]+temp[i-1,j]-4*temp[i,j]+temp[i+1,j]+temp[i,j+1]; + end; + end; + + procedure adapt(i,j : longint); + + begin + if (i=0) and (j=0) then + begin + temp[i,j]:=(Bi[i,j]*boundary[i,j]+0.5*temp[i,j+1]+0.5*temp[i+1,j])/(1+Bi[i,j]); + end + else if (i=0) and (j=h) then + begin + temp[i,j]:=(Bi[i,j]*boundary[i,j]+0.5*temp[i,j-1]+0.5*temp[i+1,j])/(1+Bi[i,j]); + end + else if (i=w) and (j=0) then + begin + temp[i,j]:=(Bi[i,j]*boundary[i,j]+0.5*temp[i,j+1]+0.5*temp[i-1,j])/(1+Bi[i,j]); + end + else if (i=w) and (j=h) then + begin + temp[i,j]:=(Bi[i,j]*boundary[i,j]+0.5*temp[i,j-1]+0.5*temp[i-1,j])/(1+Bi[i,j]); + end + else if i=0 then + begin + temp[i,j]:=(Bi[i,j]*boundary[i,j]+temp[i+1,j]+0.5*temp[i,j-1]+0.5*temp[i,j+1])/(2+Bi[i,j]); + end + else if i=w then + begin + temp[i,j]:=(Bi[i,j]*boundary[i,j]+temp[i-1,j]+0.5*temp[i,j-1]+0.5*temp[i,j+1])/(2+Bi[i,j]); + end + else if j=0 then + begin + temp[i,j]:=(Bi[i,j]*boundary[i,j]+temp[i,j+1]+0.5*temp[i-1,j]+0.5*temp[i+1,j])/(2+Bi[i,j]); + end + else if j=h then + begin + temp[i,j]:=(Bi[i,j]*boundary[i,j]+temp[i,j-1]+0.5*temp[i-1,j]+0.5*temp[i+1,j])/(2+Bi[i,j]); + end + else + temp[i,j]:=(temp[i,j-1]+temp[i-1,j]+temp[i+1,j]+temp[i,j+1])/4; + end; + + var + iter,i,j,mi,mj : longint; + habs,sigma_phi : double; + + begin + clrscr; + iter:=0; + { setup boundary conditions } + for i:=0 to w do + for j:=0 to h do + begin + if (i=0) or (i=w) then + bi[i,j]:=100 + else + bi[i,j]:=100; + + if (j=0) then + boundary[i,j]:=1000 + else + boundary[i,j]:=300; + end; + init; + draw; + repeat + calc_phi; + mi:=0; + mj:=0; + sigma_phi:=0; + inc(iter); + habs:=abs(phi[mi,mj]); + for i:=0 to w do + for j:=0 to h do + begin + if abs(phi[i,j])>habs then + begin + mi:=i; + mj:=j; + habs:=abs(phi[mi,mj]); + end; + { calculate error } + sigma_phi:=sigma_phi+abs(phi[i,j]); + end; + adapt(mi,mj); + gotoxy(1,23); + textcolor(white); + writeln(iter,' iterations, sigma_phi=',sigma_phi); + until {keypressed or }(sigma_phi<0.5); + draw; + gotoxy(1,23); + textcolor(white); + writeln(iter,' iterations, sigma_phi=',sigma_phi); + {writeln('press a key'); + if readkey=#0 then + readkey;} + end. diff --git a/tests/tbs0017.pp b/tests/tbs0017.pp new file mode 100644 index 0000000000..eefa916f6e --- /dev/null +++ b/tests/tbs0017.pp @@ -0,0 +1,27 @@ + procedure init; + + var + endofparas : boolean; + + procedure getparastring; + + procedure nextopt; + + begin + getparastring; + init; + endofparas:=false; + end; + + begin + nextopt; + end; + + begin + getparastring; + end; + +begin + init; +end. + diff --git a/tests/tbs0018.pp b/tests/tbs0018.pp new file mode 100644 index 0000000000..063088da5f --- /dev/null +++ b/tests/tbs0018.pp @@ -0,0 +1,12 @@ +type + p = ^x; + x = byte; + +var + b : p; + +begin + new(b); + b^:=12; +end. + diff --git a/tests/tbs0019.pp b/tests/tbs0019.pp new file mode 100644 index 0000000000..84e6f0f1f9 --- /dev/null +++ b/tests/tbs0019.pp @@ -0,0 +1,13 @@ +type + b = ^x; + + x = byte; + +var + pb : b; + +begin + new(pb); + pb^:=10; +end. +