home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
t
/
tspa3140.zip
/
TSUNTF.TST
< prev
next >
Wrap
Text File
|
1992-09-20
|
3KB
|
121 lines
(* This is a test program for the TSUNTF.TPU unit
All rights reserved 19-Aug-89
Updated 23-Sep-89, 21-Mar-90, 20-Sep-92
*)
uses Dos,
Crt,
TSUNTF;
procedure LOGO;
begin
writeln;
writeln ('TSUNTF unit test by Prof. Timo Salmi, 20-Sep-92');
writeln ('University of Vaasa, Finland, ts@uwasa.fi');
writeln;
writeln ('....:....1....:....2....:....3....:....4....:....5....:....6....:....7....:....');
end; (* logo *)
(* Input line-editing *)
procedure TEST1;
var sj : string;
prompt : string;
tmp : string;
begin
prompt := 'Give your input> ';
FillChar (tmp, SizeOf(tmp), '.'); { If you are wondering about these two, }
tmp[0] := chr(Length(prompt)); { they just produce points to show where}
repeat { we are. }
EDRDLN (prompt, sj);
writeln (tmp, sj);
until sj = 'exit';
end; (* test1 *)
(* Input line-editing with recall potential *)
procedure TEST2;
var sj : string;
old : string;
prompt : string;
begin
prompt := 'Give your input> ';
old := '';
repeat
EDREADLN (prompt, old, sj);
writeln (sj);
old := sj;
until sj = 'exit';
end; (* test2 *)
(* Iput line-editing with recall and break potential *)
procedure TEST3;
var sj : string;
old : string;
prompt : string;
tmp : string;
BreakPressed : boolean;
begin
prompt := 'Give your input> ';
old := '';
repeat
EDREABLN (prompt, old, 79, sj, BreakPressed);
writeln (sj);
old := sj;
until BreakPressed; {Press ctrl-c or break}
writeln ('Break was pressed');
end; (* test3 *)
(* Test input line-editing with recall and pre-fill potential.
Important, you must always assign a value to the PrefillString
before invoking this routine. Else you will have a random default
with unexpected results *)
procedure TEST4;
var sj : string;
old : string;
prompt : string;
prefill : string;
begin
prompt := 'Give your input> ';
prefill := 'Testing for the prefill';
old := prefill;
repeat
EDRDEFLN (prompt, old, prefill, sj);
prefill := '';
writeln (sj);
if sj <> '' then old := sj;
until sj = 'exit';
end; (* test4 *)
(* Test input line-editing with recall and pre-fill potential.
Important, you must always assign a value to the PrefillString
before invoking this routine. Else you will have a random default
with unexpected results *)
procedure TEST5;
var sj : string;
old : string;
prompt : string;
prefill : string;
BreakPressed : boolean;
begin
prompt := 'Give your input> ';
prefill := 'Testing for the prefill';
old := prefill;
repeat
EDRDEBLN (prompt, old, prefill, 79, sj, BreakPressed);
prefill := '';
writeln (sj);
if sj <> '' then old := sj;
until BreakPressed; {Press ctrl-c or break}
writeln ('Break was pressed');
end; (* test5 *)
(* Main program *)
begin
ClrScr;
LOGO;
{ TEST1; }
{ TEST2; }
{ TEST3; }
TEST4;
{ TEST5; }
end. (* tsuntf.tst *)