+ readln testing

This commit is contained in:
carl 2002-11-10 15:23:11 +00:00
parent bddb2b06ff
commit fb66ed48d8
6 changed files with 604 additions and 0 deletions

View File

@ -0,0 +1 @@
a cdthis z #13 $7F $FF +$33 -$7F 127 255 +33 -127 $7FFF $FFFF +$1234 -$7FFF 12700 2550 +33200 -12700 $7FFFFFFF $FFFFFFFF +$12341234 -$7FFFFFFF 12700 2550 +2147483647 -2147483648 01234 1278.1278 121223.1278E00 121224.1278e2 121225.1278E02 121216.1278E+00 121227.1278e+2 121228.1278E+02 121233.1278E-00 121234.1278e-2 Thisisaverylongstringwhichissupposedtohavemorethan255characters,itshouldbetruncatedsomewhere in the middle of the string, but i'm really not sure where it will be truncated exactly. Lets check this out and assume that GNU does not mean GNU, then what would it mean? Hello world! Verify what happens with the '' characters This is a null terminated string!

View File

@ -0,0 +1,42 @@
a
cdthis
z
#13
$7F
$FF
+$33
-$7F
127
255
+33
-127
$7FFF
$FFFF
+$1234
-$7FFF
12700
2550
+33200
-12700
$7FFFFFFF
$FFFFFFFF
+$12341234
-$7FFFFFFF
12700
2550
+2147483647
-2147483648
01234
1278.1278
121223.1278E00
121224.1278e2
121225.1278E02
121216.1278E+00
121227.1278e+2
121228.1278E+02
121233.1278E-00
121234.1278e-2
Thisisaverylongstringwhichissupposedtohavemorethan255characters,itshouldbetruncatedsomewhere in the middle of the string, but i'm really not sure where it will be truncated exactly. Lets check this out and assume that GNU does not mean GNU, then what would it mean?
Hello world!
Verify what happens with the '' characters
This is a null terminated string!

View File

@ -0,0 +1,42 @@
a
cdthis
z
#13
$7F
$FF
+$33
-$7F
127
255
+33
-127
$7FFF
$FFFF
+$1234
-$7FFF
12700
2550
+33200
-12700
$7FFFFFFF
$FFFFFFFF
+$12341234
-$7FFFFFFF
12700
2550
+2147483647
-2147483648
01234
1278.1278
121223.1278E00
121224.1278e2
121225.1278E02
121216.1278E+00
121227.1278e+2
121228.1278E+02
121233.1278E-00
121234.1278e-2
Thisisaverylongstringwhichissupposedtohavemorethan255characters,itshouldbetruncatedsomewhere in the middle of the string, but i'm really not sure where it will be truncated exactly. Lets check this out and assume that GNU does not mean GNU, then what would it mean?
Hello world!
Verify what happens with the '' characters
This is a null terminated string!

View File

@ -0,0 +1,173 @@
Program trdtxt01;
uses strings;
procedure test(b: boolean);
begin
if b then exit;
WriteLn('Error : Invalid data read!');
halt(1);
end;
var
T: Text;
value_char: char;
value_byte: byte;
value_shortint : shortint;
value_smallint : smallint;
value_word : word;
value_longint : longint;
value_longword : cardinal;
value_real : real;
value_shortstr : shortstring;
value_pchar : array[0..255] of char;
Begin
Assign(T,'testpc.txt');
Reset(T);
{ Read all the data in the correct order }
{ Read some characters }
value_char := #0;
ReadLn(T,value_char);
test(value_char = 'a');
value_char := #0;
ReadLn(T,value_char);
test(value_char = 'c');
value_char := #0;
ReadLn(T,value_char);
test(value_char = 'z');
value_char := #0;
ReadLn(T,value_char);
test(value_char = '#');
{ ***** Read some integer values ***** }
{**** HEX ****}
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 127);
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 255);
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 51);
value_shortint := 0;
ReadLn(T,value_shortint);
test(value_shortint = -127);
{*** Integral *** }
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 127);
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 255);
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 33);
value_shortint := 0;
ReadLn(T,value_shortint);
test(value_shortint = -127);
{**** HEX ****}
value_word := 0;
ReadLn(T,value_word);
test(value_word = 32767);
value_word := 0;
ReadLn(T,value_word);
test(value_word = 65535);
value_word := 0;
ReadLn(T,value_word);
test(value_word = 4660);
value_smallint := 0;
ReadLn(T,value_smallint);
test(value_smallint = -32767);
{*** Integral *** }
value_word := 0;
ReadLn(T,value_word);
test(value_word = 12700);
value_word := 0;
ReadLn(T,value_word);
test(value_word = 2550);
value_word := 0;
ReadLn(T,value_word);
test(value_word = +33200);
value_smallint := 0;
ReadLn(T,value_smallint);
test(value_smallint = -12700);
{**** HEX ****}
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = +$7FFFFFFF);
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = $FFFFFFFF);
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = $12341234);
value_longint := 0;
ReadLn(T,value_longint);
test(value_longint = -$7FFFFFFF);
{*** Integral *** }
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = 12700);
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = 2550);
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = +2147483647);
value_longint := 0;
ReadLn(T,value_longint);
{ test(value_longint = -2147483648);}
{ Read some real type values }
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(01234));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(1278.1278));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121223.1278E00));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121224.1278e2));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121225.1278E02));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121216.1278E+00));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121227.1278e+2));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121228.1278E+02));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121233.1278E-00));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121234.1278e-2));
{ Read some strings }
value_shortstr := '';
ReadLn(T,value_shortstr);
test(length(value_shortstr) = 255);
value_shortstr := '';
ReadLn(T,value_shortstr);
test(value_shortstr = 'Hello world!');
value_shortstr := '';
ReadLn(T,value_shortstr);
test(length(value_shortstr) = 42);
{ Read a null terminated value }
value_shortstr := '';
ReadLn(T,value_pchar);
test(strlen(value_pchar) = 33);
{ Read a value_charhar and make sure the value is value_chartrl-Z (#26) }
ReadLn(T,value_char);
test(value_char = #26);
Close(T);
WriteLn('All tests Ok!');
end.

View File

@ -0,0 +1,173 @@
Program trdtxt02;
uses strings;
procedure test(b: boolean);
begin
if b then exit;
WriteLn('Error : Invalid data read!');
halt(1);
end;
var
T: Text;
value_char: char;
value_byte: byte;
value_shortint : shortint;
value_smallint : smallint;
value_word : word;
value_longint : longint;
value_longword : cardinal;
value_real : real;
value_shortstr : shortstring;
value_pchar : array[0..255] of char;
Begin
Assign(T,'testux.txt');
Reset(T);
{ Read all the data in the correct order }
{ Read some characters }
value_char := #0;
ReadLn(T,value_char);
test(value_char = 'a');
value_char := #0;
ReadLn(T,value_char);
test(value_char = 'c');
value_char := #0;
ReadLn(T,value_char);
test(value_char = 'z');
value_char := #0;
ReadLn(T,value_char);
test(value_char = '#');
{ ***** Read some integer values ***** }
{**** HEX ****}
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 127);
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 255);
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 51);
value_shortint := 0;
ReadLn(T,value_shortint);
test(value_shortint = -127);
{*** Integral *** }
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 127);
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 255);
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 33);
value_shortint := 0;
ReadLn(T,value_shortint);
test(value_shortint = -127);
{**** HEX ****}
value_word := 0;
ReadLn(T,value_word);
test(value_word = 32767);
value_word := 0;
ReadLn(T,value_word);
test(value_word = 65535);
value_word := 0;
ReadLn(T,value_word);
test(value_word = 4660);
value_smallint := 0;
ReadLn(T,value_smallint);
test(value_smallint = -32767);
{*** Integral *** }
value_word := 0;
ReadLn(T,value_word);
test(value_word = 12700);
value_word := 0;
ReadLn(T,value_word);
test(value_word = 2550);
value_word := 0;
ReadLn(T,value_word);
test(value_word = +33200);
value_smallint := 0;
ReadLn(T,value_smallint);
test(value_smallint = -12700);
{**** HEX ****}
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = +$7FFFFFFF);
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = $FFFFFFFF);
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = $12341234);
value_longint := 0;
ReadLn(T,value_longint);
test(value_longint = -$7FFFFFFF);
{*** Integral *** }
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = 12700);
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = 2550);
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = +2147483647);
value_longint := 0;
ReadLn(T,value_longint);
{ test(value_longint = -2147483648);}
{ Read some real type values }
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(01234));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(1278.1278));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121223.1278E00));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121224.1278e2));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121225.1278E02));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121216.1278E+00));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121227.1278e+2));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121228.1278E+02));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121233.1278E-00));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121234.1278e-2));
{ Read some strings }
value_shortstr := '';
ReadLn(T,value_shortstr);
test(length(value_shortstr) = 255);
value_shortstr := '';
ReadLn(T,value_shortstr);
test(value_shortstr = 'Hello world!');
value_shortstr := '';
ReadLn(T,value_shortstr);
test(length(value_shortstr) = 42);
{ Read a null terminated value }
value_shortstr := '';
ReadLn(T,value_pchar);
test(strlen(value_pchar) = 33);
{ Read a value_charhar and make sure the value is value_chartrl-Z (#26) }
ReadLn(T,value_char);
test(value_char = #26);
Close(T);
WriteLn('All tests Ok!');
end.

View File

@ -0,0 +1,173 @@
Program trdtxt03;
uses strings;
procedure test(b: boolean);
begin
if b then exit;
WriteLn('Error : Invalid data read!');
halt(1);
end;
var
T: Text;
value_char: char;
value_byte: byte;
value_shortint : shortint;
value_smallint : smallint;
value_word : word;
value_longint : longint;
value_longword : cardinal;
value_real : real;
value_shortstr : shortstring;
value_pchar : array[0..255] of char;
Begin
Assign(T,'testmac.txt');
Reset(T);
{ Read all the data in the correct order }
{ Read some characters }
value_char := #0;
ReadLn(T,value_char);
test(value_char = 'a');
value_char := #0;
ReadLn(T,value_char);
test(value_char = 'c');
value_char := #0;
ReadLn(T,value_char);
test(value_char = 'z');
value_char := #0;
ReadLn(T,value_char);
test(value_char = '#');
{ ***** Read some integer values ***** }
{**** HEX ****}
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 127);
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 255);
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 51);
value_shortint := 0;
ReadLn(T,value_shortint);
test(value_shortint = -127);
{*** Integral *** }
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 127);
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 255);
value_byte := 0;
ReadLn(T,value_byte);
test(value_byte = 33);
value_shortint := 0;
ReadLn(T,value_shortint);
test(value_shortint = -127);
{**** HEX ****}
value_word := 0;
ReadLn(T,value_word);
test(value_word = 32767);
value_word := 0;
ReadLn(T,value_word);
test(value_word = 65535);
value_word := 0;
ReadLn(T,value_word);
test(value_word = 4660);
value_smallint := 0;
ReadLn(T,value_smallint);
test(value_smallint = -32767);
{*** Integral *** }
value_word := 0;
ReadLn(T,value_word);
test(value_word = 12700);
value_word := 0;
ReadLn(T,value_word);
test(value_word = 2550);
value_word := 0;
ReadLn(T,value_word);
test(value_word = +33200);
value_smallint := 0;
ReadLn(T,value_smallint);
test(value_smallint = -12700);
{**** HEX ****}
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = +$7FFFFFFF);
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = $FFFFFFFF);
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = $12341234);
value_longint := 0;
ReadLn(T,value_longint);
test(value_longint = -$7FFFFFFF);
{*** Integral *** }
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = 12700);
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = 2550);
value_longword := 0;
ReadLn(T,value_longword);
test(value_longword = +2147483647);
value_longint := 0;
ReadLn(T,value_longint);
{ test(value_longint = -2147483648);}
{ Read some real type values }
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(01234));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(1278.1278));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121223.1278E00));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121224.1278e2));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121225.1278E02));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121216.1278E+00));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121227.1278e+2));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121228.1278E+02));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121233.1278E-00));
value_real := 0.0;
ReadLn(T,value_real);
test(trunc(value_real) = trunc(121234.1278e-2));
{ Read some strings }
value_shortstr := '';
ReadLn(T,value_shortstr);
test(length(value_shortstr) = 255);
value_shortstr := '';
ReadLn(T,value_shortstr);
test(value_shortstr = 'Hello world!');
value_shortstr := '';
ReadLn(T,value_shortstr);
test(length(value_shortstr) = 42);
{ Read a null terminated value }
value_shortstr := '';
ReadLn(T,value_pchar);
test(strlen(value_pchar) = 33);
{ Read a value_charhar and make sure the value is value_chartrl-Z (#26) }
ReadLn(T,value_char);
test(value_char = #26);
Close(T);
WriteLn('All tests Ok!');
end.