Category : Pascal Source Code
Archive   : STRING.ZIP
Filename : TSUITE.PAS

 
Output of file : TSUITE.PAS contained in archive : STRING.ZIP
program test_suite;
uses crt,strings;
var s1,s2,s3,scale,lstr:string;
c1,c2,c3:char; i,j,k:integer; w:word; h:xstr;
begin
clrscr;
writeln('This program should print ONLY THIS line.');
lstr:=xrange(#1,#255);
if not abbrev('delete','del',3) then writeln('ab1');
if abbrev('delete','del ',3) then writeln('ab2');
if abbrev('delete','delete ',3) then writeln('ab3');
if not abbrev('delete','delete',3) then writeln('ab4');
if not abbrev('','',0) then writeln('ab5');
if abbrev('',' ',0) then writeln('ab5.1');
if not abbrev(lstr,copy(lstr,1,254),253) then writeln('ab6');
if abbrev(lstr,substr(lstr,1,254)+' ',254) then writeln('ab7');

if center('ABC',5,' ')<>' ABC ' then writeln('ct1');
if center('ABC',4,' ')<>'ABC ' then writeln('ct2');
if center('ABC',2,' ')<>'AB' then writeln('ct3');
if center('ABC',255,' ')<>left('',126,' ')+'ABC'+left('',126,' ') then
writeln('ct4');
if center('',3,'-')<>'---' then writeln('ct5');
if center('ABC',0,'-')<>'' then writeln('ct6');
if center(lstr,255,'-')<>lstr then writeln('ct7');

if compare('abcdef','abcxxx')<>4 then writeln('cm1');
if compare('abcdef','')<>1 then writeln('cm2');
if compare('','abcdef')<>1 then writeln('cm3');
if compare('abcdef','abcdef')<>0 then writeln('cm4');
if compare('','')<>0 then writeln('cm5');
if compare(lstr,lstr)<>0 then writeln('cm6');
if compare(lstr,copy(lstr,1,254)+' ')<>255 then writeln('cm7');

if copies('x',4)<>'xxxx' then writeln('cp1');
if copies('',255)<>'' then writeln('cp2');
if copies('xxxx',0)<>'' then writeln('cp3');
if copies('ab',3)<>'ababab' then writeln('cp4');
if copies(' ',255)<>left('',255,' ') then writeln('cp5');

if d2x(0)<>'0000' then writeln('dx1');
if d2x(256)<>'0100' then writeln('dx2');
if d2x(16)<>'0010' then writeln('dx3');
if d2x(word(-1))<>'FFFF' then writeln('dx4');

if delstr(lstr,100,5)<>xrange(#1,#99)+xrange(#105,#255) then writeln('ds1');
if delstr(lstr,250,5)<>xrange(#1,#249)+#255 then writeln('ds2');
if delstr('abcde',1,2)<>'cde' then writeln('ds3');
if delstr('abcde',6,20)<>'abcde' then writeln('ds4');
if delstr('abcde',2,0)<>'abcde' then writeln('ds5');
if delstr('abcde',0,1)<>'bcde' then writeln('ds6');

if delword('',2,255)<>'' then writeln('dw1');
if delword('one two three four five',2,3)<>'one five' then writeln('dw2');
if delword('one',1,0)<>'one' then writeln('dw3');
if delword('one two',2,2)<>'one ' then writeln('dw4');
if delword(' one ',1,1)<>' ' then writeln('dw5');

if firstpos('','hello',0)<>0 then writeln('fp1');
if firstpos('one','',1)<>0 then writeln('fp2');
if firstpos('one','one two',2)<>0 then writeln('fp3');
if firstpos('one','one two',1)<>1 then writeln('fp4');
if firstpos('two ','one two',1)<>0 then writeln('fp5');
if firstpos('two','one two',3)<>5 then writeln('fp6');

if instr('xx','',5,'a')<>'aaaaxx' then writeln('is1');
if instr('','abcde',2,' ')<>'abcde' then writeln('is2');
if instr('123',lstr,253,' ')<>substr(lstr,1,252)+'123' then writeln('is3');
if instr('abcd','123',0,' ')<>'abcd123' then writeln('is4');
if instr('1',lstr,255,' ')<>substr(lstr,1,254)+'1' then writeln('is5');
if instr('',lstr,255,' ')<>lstr then writeln('is6');

if justify('',10)<>left('',10,' ') then writeln('jf1');
if justify('one',10)<>'one ' then writeln('jf2');
if justify(copies('12345',51),255)<>copies('12345',51) then writeln('jf3');
if justify(copies('123 ',51),253)<>copies('123 ',50)+'123' then
writeln('jf4');
if justify('a b',80)<>'a'+left('',78,' ')+'b' then writeln('jf5');

if lastpos('','the quick brown fox etc.',0)<>0 then writeln('lp1');
if lastpos('t','the fox etc.',0)<>10 then writeln('lp2');
if lastpos('t','the fox etc.',9)<>1 then writeln('lp3');
if lastpos('th','the fox etc.',2)<>1 then writeln('lp4');
if lastpos('th','the fox etc.',1)<>0 then writeln('lp5');
if lastpos(#254+#255,lstr,0)<>254 then writeln('lp6');
if lastpos(#254+#255,lstr,254)<>0 then writeln('lp6.1');
if lastpos('the','',1)<>0 then writeln('lp7');
if lastpos(lstr,lstr,0)<>1 then writeln('lp8');

if left('',1,' ')<>' ' then writeln('lf1');
if left('',0,' ')<>'' then writeln('lf2');
if left('x',255,' ')<>'x'+left('',254,' ') then writeln('lf3');
if left('xx',0,' ')<>'' then writeln('lf4');
if left(lstr,255,' ')<>lstr then writeln('lf5');
if left('hello',10,'x')<>'helloxxxxx' then writeln('lf6');

if lowercase('AbCdEf123')<>'abcdef123' then writeln('lc1');
if lowercase('')<>'' then writeln('lc2');
if lowercase('A')<>'a' then writeln('lc3');
if lowercase(lstr)<>overlay(xrange('a','z'),lstr,65,' ') then writeln('lc4');

if overlay('','abcdef',1,' ')<>'abcdef' then writeln('ol1');
if overlay('','',1,' ')<>'' then writeln('ol2');
if overlay(lstr,lstr,5,' ')<>xrange(#1,#4)+xrange(#1,#251) then writeln('ol3');
if overlay('x',lstr,255,' ')<>substr(lstr,1,254)+'x' then writeln('ol4');
if overlay('hello','',5,'x')<>'xxxxhello' then writeln('ol5');
if overlay('hello',' ',5,'x')<>' xxxhello' then writeln('ol6');

if pos2word('',1)<>0 then writeln('pw1');
if pos2word('x',1)<>1 then writeln('pw2');
if pos2word(copies('1234 ',51),255)<>0 then writeln('pw3');
if pos2word(copies('1234 ',51),254)<>51 then writeln('pw4');
if pos2word(copies('1234 ',51),250)<>51 then writeln('pw5');
if pos2word(copies('1234 ',51),249)<>50 then writeln('pw6');
if pos2word('123',4)<>0 then writeln('pw7');

if reverse('x')<>'x' then writeln('rv1');
if reverse('')<>'' then writeln('rv2');
if reverse('ab')<>'ba' then writeln('rv3');
if reverse('abc')<>'cba' then writeln('rv4');
if reverse(xrange(#1,#255))<>xrange(#255,#1) then writeln('rv5');

if right('',1,' ')<>' ' then writeln('rt1');
if right('',0,' ')<>'' then writeln('rt2');
if right('x',255,' ')<>right('',254,' ')+'x' then writeln('rt3');
if right('xx',0,' ')<>'' then writeln('rt4');
if right(lstr,255,' ')<>lstr then writeln('rt5');
if right('hello',10,'x')<>'xxxxxhello' then writeln('rt6');

if space(copies('123 ',51),2)<>copies('123 ',50)+'123' then writeln('sp1');
if space(copies('1234 ',51),0)<>copies('1234',51) then writeln('sp2');
if space(' abcd ',50)<>'abcd' then writeln('sp3');
if space(lstr,2)<>substr(lstr,1,31) then writeln('sp4');
if space(' ',1)<>'' then writeln('sp5');
if space('',1)<>'' then writeln('sp5.1');
if space(copies('1234 ',51),2)<>copies('1234 ',41)+'1234' then writeln('sp6');
if space(copies('1234 ',51),0)<>copies('1234',51) then writeln('sp7');
if space('a b',253)<>'a'+left('',253,' ')+'b' then writeln('sp8');
if space('a b',254)<>'a' then writeln('sp9');

if strip('--hello----','l','-')<>'hello----' then writeln('st1');
if strip('--hello----','t','-')<>'--hello' then writeln('st2');
if strip('--h----','b','-')<>'h' then writeln('st3');
if strip('------','l','-')<>'' then writeln('st4');
if strip('------','t','-')<>'' then writeln('st5');
if strip('------','b','-')<>'' then writeln('st6');
if strip('','b','-')<>'' then writeln('st7');
if strip('---h---','l','-')<>'h---' then writeln('st8');
if strip('---h---','b','-')<>'h' then writeln('st9');

if substr(lstr,1,0)<>'' then writeln('ss1');
if substr(lstr,1,255)<>lstr then writeln('ss2');
if substr('',1,20)<>'' then writeln('ss3');
if substr(lstr,255,5)<>#255 then writeln('ss4');
if substr(lstr,1,1)<>#1 then writeln('ss5');

if subword(lstr,1,1)<>xrange(#1,#31) then writeln('sw1');
if subword(' one two three',1,2)<>'one two' then writeln('sw2');
if subword(lstr,2,5)<>xrange(#33,#255) then writeln('sw3');
if subword(' one two three ',4,1)<>'' then writeln('sw4');
if subword(' one two three ',2,2)<>'two three' then writeln('sw5');
if subword(' ',1,1)<>'' then writeln('sw6');
if subword(' a one two three ',1,1)<>'a' then writeln('sw7');


if translate(lstr,lstr,reverse(lstr))<>reverse(lstr) then writeln('tr1');
if translate(lstr,'','')<>lstr then writeln('tr2');
if translate('',lstr,reverse(lstr))<>'' then writeln('tr3');
if translate('a','abc','bca')<>'b' then writeln('tr4');
if translate(lstr,lstr,lstr)<>lstr then writeln('tr5');

if uppercase('AbCdEf123')<>'ABCDEF123' then writeln('uc1');
if uppercase('')<>'' then writeln('uc2');
if uppercase('a')<>'A' then writeln('uc3');
if uppercase(lstr)<>overlay(xrange('A','Z'),lstr,97,' ') then writeln('uc4');

if verify('a',lstr,'m',1)<>1 then writeln('vr1');
if verify(lstr,'a','m',1)<>97 then writeln('vr2');
if verify(lstr,overlay(' ',lstr,100,' '),'n',1)<>100 then writeln('vr3');
if verify('a',lstr,'m',1)<>1 then writeln('vr4');
if verify('',lstr,'m',1)<>0 then writeln('vr5');
if verify(lstr,'','m',1)<>0 then writeln('vr6');
if verify(lstr,lstr,'n',1)<>0 then writeln('vr7');
if verify(lstr,overlay(' ',lstr,255,' '),'n',255)<>255 then writeln('vr7.1');
if verify('abcdef','zyxwvuc','m',4)<>0 then writeln('vr8');
if verify('abcdef','czyxwvu','m',3)<>3 then writeln('vr9');
if verify('abcdef',lstr,'n',1)<>0 then writeln('vr10');
if verify('abc1def','abcdef','n',5)<>0 then writeln('vr11');
if verify('abc1def','abcdef','n',4)<>4 then writeln('vr12');

if werd('',1)<>'' then writeln('wd1');
if werd('a b c',1)<>'a' then writeln('wd2');
if werd('a b c',3)<>'c' then writeln('wd3');
if werd(lstr,2)<>substr(lstr,33,223) then writeln('wd4');
if werd(lstr,3)<>'' then writeln('wd5');
if werd(lstr,1)<>substr(lstr,1,31) then writeln('wd6');
if werd(overlay(' ',lstr,254,' '),3)<>#255 then writeln('wd7');
if werd('one two three four five six',6)<>'six' then writeln('wd8');

if word2pos('',1)<>0 then writeln('wp1');
if word2pos(lstr,2)<>33 then writeln('wp2');
if word2pos(overlay(' ',lstr,254,' '),3)<>255 then writeln('wp3');
if word2pos('one two three four five six',3)<>9 then writeln('wp4');
if word2pos('one two three four five six',1)<>1 then writeln('wp5');
if word2pos('one two three four five six',7)<>0 then writeln('wp6');

if words(overlay(' ',lstr,254,' '))<>3 then writeln('wds1');
if words(lstr)<>2 then writeln('wds2');
if words(' ')<>0 then writeln('wds3');
if words('')<>0 then writeln('wds4');
if words('one two three four five six')<>6 then writeln('wds5');
if words(left('',255,' '))<>0 then writeln('wds6');
if words(left('',255,'x'))<>1 then writeln('wds7');

if x2d('ff')<>255 then writeln('xd1');
if x2d('0')<>0 then writeln('xd2');
if x2d('10')<>16 then writeln('xd3');
if x2d('100')<>256 then writeln('xd4');
if x2d('111')<>273 then writeln('xd5');
if x2d('1000')<>4096 then writeln('xd6');
if x2d('0001')<>1 then writeln('xd7');

if xrange(#1,#1)<>#1 then writeln('xr1');
if xrange(#0,#255)<>xrange(#0,#254) then writeln('xr2');
if xrange(#255,#1)<>reverse(xrange(#1,#255)) then writeln('xr3');
if xrange(#2,#1)<>#2+#1 then writeln('xr4');

end.


  3 Responses to “Category : Pascal Source Code
Archive   : STRING.ZIP
Filename : TSUITE.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/