*** empty log message ***

This commit is contained in:
florian 2003-01-03 01:08:33 +00:00
parent 5400c36e4f
commit fa14d04d88
8 changed files with 861 additions and 0 deletions

13
tests/test/testv1.pp Normal file
View File

@ -0,0 +1,13 @@
program testv1;
uses varutils;
Var
Varia : TVardata;
begin
Writeln(SizeOf(Varia));
Writeln('Initializing variant');
VariantInit(Varia);
DumpVariant(Varia);
end.

124
tests/test/testv2.pp Normal file
View File

@ -0,0 +1,124 @@
{ %version=1.1 }
program testv2;
uses variants,varutils;
Procedure TestLongInt;
Var
V : Variant;
I : LongInt;
begin
Writeln('Longint assignment');
I:=1;
V:=I;
DumpVariant(TVarData(V));
end;
Procedure TestSmallInt;
Var
V : Variant;
I : SmallInt;
begin
Writeln('Smallint assignment');
I:=2;
V:=I;
DumpVariant(TVarData(V));
end;
Procedure TestShortInt;
Var
V : Variant;
I : ShortInt;
begin
Writeln('ShortInt assignment');
I:=3;
V:=I;
DumpVariant(TVarData(V));
end;
Procedure TestCardinal;
Var
V : Variant;
C : Cardinal;
begin
Writeln('Cardinal assignment');
C:=4;
V:=C;
DumpVariant(TVarData(V));
end;
Procedure TestWord;
Var
V : Variant;
W : Word;
begin
Writeln('Word assignment');
W:=5;
V:=W;
DumpVariant(TVarData(V));
end;
Procedure TestByte;
Var
V : Variant;
B : Byte;
begin
Writeln('Byte assignment');
B:=6;
V:=B;
DumpVariant(TVarData(V));
end;
// 64 bit values
Procedure TestInt64;
Var
V : Variant;
I : int64;
begin
Writeln('Int64 assignment');
I:=7;
V:=I;
DumpVariant(TVarData(V));
end;
Procedure TestQWord;
Var
V : Variant;
Q : QWord;
begin
Writeln('QWord assignment');
Q:=8;
V:=Q;
DumpVariant(TVarData(V));
end;
begin
TestLongint;
TestSmallInt;
TestShortInt;
TestCardinal;
TestWord;
TestByte;
TestInt64;
TestQWord;
end.

131
tests/test/testv3.pp Normal file
View File

@ -0,0 +1,131 @@
program testv3;
uses variants,varutils;
Procedure TestLongInt;
Var
V : Variant;
I,J : LongInt;
begin
Writeln('Longint assignment');
I:=1;
V:=I;
J:=V;
Writeln('Result (',I,'): ',J);
end;
Procedure TestSmallInt;
Var
V : Variant;
I,J : SmallInt;
begin
Writeln('Smallint assignment');
I:=2;
V:=I;
J:=V;
Writeln('Result (',I,'): ',J);
end;
Procedure TestShortInt;
Var
V : Variant;
I,J : ShortInt;
begin
Writeln('ShortInt assignment');
I:=3;
V:=I;
J:=V;
Writeln('Result (',I,'): ',J);
end;
Procedure TestCardinal;
Var
V : Variant;
C,D : Cardinal;
begin
Writeln('Cardinal assignment');
C:=4;
V:=C;
D:=V;
Writeln('Result (',C,'): ',D);
end;
Procedure TestWord;
Var
V : Variant;
W,X : Word;
begin
Writeln('Word assignment');
W:=5;
V:=W;
X:=V;
Writeln('Result (',X,'): ',W);
end;
Procedure TestByte;
Var
V : Variant;
B,C : Byte;
begin
Writeln('Byte assignment');
B:=6;
V:=B;
C:=V;
Writeln('Result (',B,'): ',C);
end;
// 64 bit values
Procedure TestInt64;
Var
V : Variant;
I,J : int64;
begin
Writeln('Int64 assignment');
I:=7;
V:=I;
J:=V;
Writeln('Result (',I,'): ',J);
end;
Procedure TestQWord;
Var
V : Variant;
Q,R : QWord;
begin
Writeln('QWord assignment');
Q:=8;
V:=Q;
R:=V;
Writeln('Result (',Q,'): ',R);
end;
begin
TestLongint;
TestSmallInt;
TestShortInt;
TestCardinal;
TestWord;
TestByte;
TestInt64;
TestQWord;
end.

148
tests/test/testv4.pp Normal file
View File

@ -0,0 +1,148 @@
program testv3;
uses variants,varutils;
Procedure TestConvert(Var V : Variant);
Var
I64 : Int64;
LI : Longint;
SI : Smallint;
HI : Shortint;
Q : QWord;
C : Cardinal;
W : Word;
B : Byte;
begin
DumpVariant(TVarData(V));
I64:=V;
Writeln('To Int64 : ',I64);
LI:=V;
Writeln('To Longint : ',LI);
SI:=V;
Writeln('To Smallint : ',SI);
HI:=V;
Writeln('To Shortint : ',HI);
Q:=V;
Writeln('To QWord : ',Q);
C:=V;
Writeln('To Cardinal : ',C);
W:=V;
Writeln('To Word : ',W);
B:=V;
Writeln('To Byte : ',B);
end;
Procedure TestLongInt;
Var
V : Variant;
I : LongInt;
begin
I:=1;
V:=I;
TestConvert(V);
end;
Procedure TestSmallInt;
Var
V : Variant;
I : SmallInt;
begin
I:=2;
V:=I;
TestConvert(V);
end;
Procedure TestShortInt;
Var
V : Variant;
I : ShortInt;
begin
I:=3;
V:=I;
TestConvert(V);
end;
Procedure TestCardinal;
Var
V : Variant;
C : Cardinal;
begin
C:=4;
V:=C;
TestConvert(V);
end;
Procedure TestWord;
Var
V : Variant;
W : Word;
begin
W:=5;
V:=W;
TestConvert(V);
end;
Procedure TestByte;
Var
V : Variant;
B : Byte;
begin
B:=6;
V:=B;
TestConvert(V);
end;
// 64 bit values
Procedure TestInt64;
Var
V : Variant;
I : int64;
begin
I:=7;
V:=I;
TestConvert(V);
end;
Procedure TestQWord;
Var
V : Variant;
Q : QWord;
begin
Q:=8;
V:=Q;
TestConvert(V);
end;
begin
TestLongint;
TestSmallInt;
TestShortInt;
TestCardinal;
TestWord;
TestByte;
TestInt64;
TestQWord;
end.

137
tests/test/testv5.pp Normal file
View File

@ -0,0 +1,137 @@
program testv5;
uses variants,varutils;
Procedure TestLongInt(I : Longint);
Var
V : Variant;
B : Boolean;
begin
Write('Longint to boolean assignment: ');
V:=I;
B:=V;
Writeln(I,' -> ',B);
end;
Procedure TestSmallInt(I : SmallInt);
Var
V : Variant;
B : Boolean;
begin
Write('Smallint to boolean assignment: ');
V:=I;
B:=V;
Writeln(I,' -> ',B);
end;
Procedure TestShortInt(I : ShortInt);
Var
V : Variant;
B : Boolean;
begin
Write('Shortint to boolean assignment: ');
V:=I;
B:=V;
Writeln(I,' -> ',B);
end;
Procedure TestCardinal(I : Cardinal);
Var
V : Variant;
B : Boolean;
begin
Write('Cardinal to boolean assignment: ');
V:=I;
B:=V;
Writeln(I,' -> ',B);
end;
Procedure TestWord(I : Word);
Var
V : Variant;
B : Boolean;
begin
Write('Word to boolean assignment: ');
V:=I;
B:=V;
Writeln(I,' -> ',B);
end;
Procedure TestByte(I : Byte);
Var
V : Variant;
B : Boolean;
begin
Write('Byte to boolean assignment: ');
V:=I;
B:=V;
Writeln(I,' -> ',B);
end;
// 64 bit values
Procedure TestInt64(I : Int64);
Var
V : Variant;
B : Boolean;
begin
Write('Int64 to boolean assignment: ');
V:=I;
B:=V;
Writeln(I,' -> ',B);
end;
Procedure TestQWord(I : QWord);
Var
V : Variant;
B : Boolean;
begin
Write('QWord to boolean assignment: ');
V:=I;
B:=V;
Writeln(I,' -> ',B);
end;
begin
TestLongint(0);
TestSmallInt(0);
TestShortInt(0);
TestCardinal(0);
TestWord(0);
TestByte(0);
TestInt64(0);
TestQWord(0);
TestLongint(-1);
TestSmallInt(-1);
TestShortInt(-1);
TestCardinal(-1);
TestWord(-1);
TestByte(-1);
TestInt64(-1);
TestQWord(-1);
TestLongint(1);
TestSmallInt(1);
TestShortInt(1);
TestCardinal(1);
TestWord(1);
TestByte(1);
TestInt64(1);
TestQWord(1);
end.

128
tests/test/testv6.pp Normal file
View File

@ -0,0 +1,128 @@
program testv6;
uses variants,varutils;
Procedure TestLongInt(B : Boolean);
Var
V : Variant;
I : LongInt;
begin
Write('Longint assignment : ',B,' -> ');
V:=B;
I:=V;
Writeln(I);
end;
Procedure Testsmallint(B : Boolean);
Var
V : Variant;
I : smallint;
begin
Write('smallint assignment : ',B,' -> ');
V:=B;
I:=V;
Writeln(I);
end;
Procedure TestShortInt(B : Boolean);
Var
V : Variant;
I : ShortInt;
begin
Write('ShortInt assignment : ',B,' -> ');
V:=B;
I:=V;
Writeln(I);
end;
Procedure TestCardinal(B : Boolean);
Var
V : Variant;
I : Cardinal;
begin
Write('Cardinal assignment : ',B,' -> ');
V:=B;
I:=V;
Writeln(I);
end;
Procedure TestWord(B : Boolean);
Var
V : Variant;
I : Word;
begin
Write('Word assignment : ',B,' -> ');
V:=B;
I:=V;
Writeln(I);
end;
Procedure TestByte(B : Boolean);
Var
V : Variant;
I : Byte;
begin
Write('Byte assignment : ',B,' -> ');
V:=B;
I:=V;
Writeln(I);
end;
Procedure TestInt64(B : Boolean);
Var
V : Variant;
I : Int64;
begin
Write('Int64 assignment : ',B,' -> ');
V:=B;
I:=V;
Writeln(I);
end;
Procedure TestQWord(B : Boolean);
Var
V : Variant;
I : QWord;
begin
Write('QWord assignment : ',B,' -> ');
V:=B;
I:=V;
Writeln(I);
end;
begin
TestLongint(True);
TestSmallInt(True);
TestShortInt(True);
TestCardinal(True);
TestWord(True);
TestByte(True);
TestInt64(True);
TestQWord(True);
TestLongint(False);
TestSmallInt(False);
TestShortInt(False);
TestCardinal(False);
TestWord(False);
TestByte(False);
TestInt64(False);
TestQWord(False);
end.

62
tests/test/testv7.pp Normal file
View File

@ -0,0 +1,62 @@
program testv2;
uses variants,varutils;
Procedure TestReal;
Var
V : Variant;
R : Real;
begin
Writeln('Real assignment');
R:=1.0E-1;
V:=R;
DumpVariant(TVarData(V));
end;
Procedure TestDouble;
Var
V : Variant;
R : Double;
begin
Writeln('Double assignment');
R:=2.0E-2;
V:=R;
DumpVariant(TVarData(V));
end;
Procedure TestExtended;
Var
V : Variant;
R : Extended;
begin
Writeln('Extended assignment');
R:=3.0E-3;
V:=R;
DumpVariant(TVarData(V));
end;
Procedure TestSingle;
Var
V : Variant;
R : Single;
begin
Writeln('Single assignment');
R:=4.0E-4;
V:=R;
DumpVariant(TVarData(V));
end;
begin
TestReal;
TestDouble;
TestExtended;
TestSingle;
end.

118
tests/test/testv8.pp Normal file
View File

@ -0,0 +1,118 @@
program testv8;
uses variants,varutils;
Procedure TestConvert(Var V : Variant);
Var
I64 : Int64;
LI : Longint;
SI : Smallint;
HI : Shortint;
Q : QWord;
C : Cardinal;
W : Word;
B : Byte;
R : Real;
D : Double;
E : Extended;
S : Single;
Bo : Boolean;
begin
DumpVariant(TVarData(V));
I64:=V;
Writeln('To Int64 : ',I64);
LI:=V;
Writeln('To Longint : ',LI);
SI:=V;
Writeln('To Smallint : ',SI);
HI:=V;
Writeln('To Shortint : ',HI);
Q:=V;
Writeln('To QWord : ',Q);
C:=V;
Writeln('To Cardinal : ',C);
W:=V;
Writeln('To Word : ',W);
B:=V;
Writeln('To Byte : ',B);
R:=V;
Writeln('To Real : ',R);
D := v;
Writeln('To Double : ',D);
E := v;
Writeln('To Extended : ',E);
S := v;
Writeln('To Single : ',S);
Bo := v;
Writeln('To Boolean : ',Bo);
end;
Procedure TestReal(R : Real);
Var
V : Variant;
begin
V:=R;
TestConvert(V);
V:=-R;
TestConvert(V);
end;
Procedure TestDouble(R : Double);
Var
V : Variant;
begin
V:=R;
TestConvert(V);
V:=-R;
TestConvert(V);
end;
Procedure TestSingle(R : Single);
Var
V : Variant;
begin
V:=R;
TestConvert(V);
V:=-R;
TestConvert(V);
end;
Procedure TestExtended(R : Extended);
Var
V : Variant;
begin
V:=R;
TestConvert(V);
V:=-R;
TestConvert(V);
end;
begin
TestReal(1.0E-1);
TestDouble(2.0E-2);
TestSingle(3.0E-3);
TestExtended(4.0E-4);
TestReal(1.0E1);
TestDouble(2.0E2);
TestSingle(3.0E3);
TestExtended(4.0E4);
TestReal(0.0);
TestDouble(0.0);
TestSingle(0.0);
TestExtended(0.0);
TestReal(1.0E-39);
TestDouble(2.0E-39);
TestSingle(3.0E-39);
TestExtended(4.0E-39);
end.