* some more tests:

- str
     - qword -> real type cast
     - ...
This commit is contained in:
florian 1999-07-04 16:32:57 +00:00
parent 06c7d3233f
commit d45197ca53

View File

@ -556,6 +556,7 @@ procedure testtypecastqword;
l1,l2 : longint; l1,l2 : longint;
d1,d2 : dword; d1,d2 : dword;
q1,q2 : qword; q1,q2 : qword;
d1,d2 : double;
begin begin
{ shortint } { shortint }
@ -632,6 +633,33 @@ procedure testtypecastqword;
d2:=q2; d2:=q2;
if d1<>d2 then if d1<>d2 then
do_error(2005); do_error(2005);
{ real }
{ memory location }
q1:=12;
d1:=q1;
d2:=12;
if d1<>d2 then
do_error(2012);
{ register location }
q1:=12;
d1:=q1+1;
d2:=13;
if d1<>d2 then
do_error(2013);
// a constant which can't be loaded with fild
q1:=$80000000;
q1:=q1 shl 32;
d1:=q1;
d2:=$80000000;
if d1<>d2*d2*2.0 then
do_error(20);
// register location
d1:=q1+1;
if d1<>d2*d2*2.0+1 then
do_error(2014);
end; end;
procedure testioqword; procedure testioqword;
@ -677,26 +705,29 @@ procedure teststringqword;
q1,q2 : qword; q1,q2 : qword;
s : string; s : string;
l : longint; l : longint;
a : ansistring;
begin begin
{!!!!!!!!!!! { testing str: shortstring }
{ testing str }
// simple tests // simple tests
q1:=1; q1:=1;
int_str(q1,s); str(q1,s);
if s<>'1' then if s<>'1' then
do_error(2200); do_error(2200);
// simple tests // simple tests
q1:=0; q1:=0;
int_str(q1,s); str(q1,s);
if s<>'0' then if s<>'0' then
do_error(2201); do_error(2201);
// more complex tests // more complex tests
q1:=4321; q1:=4321;
int_str(q1,s); str(q1,s);
if s<>'4321' then if s<>'4321' then
do_error(2202); do_error(2202);
str(q1:6,s);
if s<>' 4321' then
do_error(2203);
// create a big qword: // create a big qword:
q2:=1234; q2:=1234;
@ -704,12 +735,32 @@ procedure teststringqword;
q2:=q2*l; q2:=q2*l;
l:=54321; l:=54321;
q2:=q2+l; q2:=q2+l;
int_str(q2,s); str(q2,s);
if s<>'1234000054321' then if s<>'1234000054321' then
do_error(2203); do_error(2204);
{ testing str: ansistring }
// more complex tests
q1:=4321;
str(q1,a);
if a<>'4321' then
do_error(2205);
str(q1:6,a);
if a<>' 4321' then
do_error(2206);
// create a big qword:
q2:=1234;
l:=1000000000;
q2:=q2*l;
l:=54321;
q2:=q2+l;
str(q2,a);
if a<>'1234000054321' then
do_error(2207);
{ testing val } { testing val }
{ !!!!!!! } { !!!!!!! }
}
end; end;
procedure testmodqword; procedure testmodqword;
@ -932,6 +983,8 @@ procedure testintqword;
do_error(2602); do_error(2602);
if hi(q1+$f0000000)<>$fafafafa then if hi(q1+$f0000000)<>$fafafafa then
do_error(2603); do_error(2603);
// swap
assignqword($03030303,$fafafafa,q2); assignqword($03030303,$fafafafa,q2);
if swap(q1)<>q2 then if swap(q1)<>q2 then
do_error(2604); do_error(2604);