* Added to svn

This commit is contained in:
michael 2020-04-26 21:05:20 +00:00
parent 58ae11c6d3
commit 7d6569c6ff
7 changed files with 1206 additions and 48 deletions

View File

@ -1,3 +1,25 @@
{ Component streaming tests.
Copyright (C) 2020 Michael Van Canneyt michael@freepascal.org
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version
with the following modification:
As a special exception, the copyright holders of this library give you permission to link this library with independent modules
to produce an executable, regardless of the license terms of these independent modules,and to copy and distribute the resulting
executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions
of the license of that module. An independent module is a module which is not derived from or based on this library. If you
modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do
not wish to do so, delete this exception statement from your version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA.
}
Unit tccompstreaming; Unit tccompstreaming;
interface interface
@ -1430,14 +1452,14 @@ end;
procedure TTestComponentStream.TestTIntegerComponent2Text; procedure TTestComponentStream.TestTIntegerComponent2Text;
Const Const
SData = SData3 =
'object TestTIntegerComponent2: TIntegerComponent2'+sLineBreak+ 'object TestTIntegerComponent2: TIntegerComponent2'+sLineBreak+
' IntProp = 1024'+sLineBreak+ ' IntProp = 1024'+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTIntegerComponent2; TestTIntegerComponent2;
CheckAsString(SData); CheckAsString(SData3);
end; end;
@ -1466,14 +1488,14 @@ end;
procedure TTestComponentStream.TestTIntegerComponent3Text; procedure TTestComponentStream.TestTIntegerComponent3Text;
Const Const
SData = SData4 =
'object TestTIntegerComponent3: TIntegerComponent3'+sLineBreak+ 'object TestTIntegerComponent3: TIntegerComponent3'+sLineBreak+
' IntProp = 262144'+sLineBreak+ ' IntProp = 262144'+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTIntegerComponent3; TestTIntegerComponent3;
CheckAsString(SData); CheckAsString(SData4);
end; end;
@ -1546,14 +1568,14 @@ end;
procedure TTestComponentStream.TestTInt64ComponentText; procedure TTestComponentStream.TestTInt64ComponentText;
Const Const
SData = SData5 =
'object TestTInt64Component: TInt64Component'+sLineBreak+ 'object TestTInt64Component: TInt64Component'+sLineBreak+
' Int64Prop = 4'+sLineBreak+ ' Int64Prop = 4'+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTInt64Component; TestTInt64Component;
CheckAsString(SData); CheckAsString(SData5);
end; end;
@ -1582,14 +1604,14 @@ end;
procedure TTestComponentStream.TestTInt64Component2Text; procedure TTestComponentStream.TestTInt64Component2Text;
Const Const
SData = SData6 =
'object TestTInt64Component2: TInt64Component2'+sLineBreak+ 'object TestTInt64Component2: TInt64Component2'+sLineBreak+
' Int64Prop = 1024'+sLineBreak+ ' Int64Prop = 1024'+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTInt64Component2; TestTInt64Component2;
CheckAsString(SData); CheckAsString(SData6);
end; end;
@ -1618,14 +1640,14 @@ end;
procedure TTestComponentStream.TestTInt64Component3Text; procedure TTestComponentStream.TestTInt64Component3Text;
Const Const
SData = SData7 =
'object TestTInt64Component3: TInt64Component3'+sLineBreak+ 'object TestTInt64Component3: TInt64Component3'+sLineBreak+
' Int64Prop = 262144'+sLineBreak+ ' Int64Prop = 262144'+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTInt64Component3; TestTInt64Component3;
CheckAsString(SData); CheckAsString(SData7);
end; end;
@ -1654,14 +1676,14 @@ end;
procedure TTestComponentStream.TestTInt64Component4Text; procedure TTestComponentStream.TestTInt64Component4Text;
Const Const
SData = SData8 =
'object TestTInt64Component4: TInt64Component4'+sLineBreak+ 'object TestTInt64Component4: TInt64Component4'+sLineBreak+
' Int64Prop = 2147516415'+sLineBreak+ ' Int64Prop = 2147516415'+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTInt64Component4; TestTInt64Component4;
CheckAsString(SData); CheckAsString(SData8);
end; end;
@ -1736,14 +1758,14 @@ end;
procedure TTestComponentStream.TestTStringComponentText; procedure TTestComponentStream.TestTStringComponentText;
Const Const
SData = SData9 =
'object TestTStringComponent: TStringComponent'+sLineBreak+ 'object TestTStringComponent: TStringComponent'+sLineBreak+
' StringProp = ''A string'''+sLineBreak+ ' StringProp = ''A string'''+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTStringComponent; TestTStringComponent;
CheckAsString(SData); CheckAsString(SData9);
end; end;
@ -1790,14 +1812,14 @@ end;
procedure TTestComponentStream.TestTStringComponent3Text; procedure TTestComponentStream.TestTStringComponent3Text;
Const Const
SData = SData10 =
'object TestTStringComponent3: TStringComponent3'+sLineBreak+ 'object TestTStringComponent3: TStringComponent3'+sLineBreak+
' StringProp = ''A ''''quoted'''' string'''+sLineBreak+ ' StringProp = ''A ''''quoted'''' string'''+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTStringComponent3; TestTStringComponent3;
CheckAsString(SData); CheckAsString(SData10);
end; end;
@ -1825,14 +1847,14 @@ end;
procedure TTestComponentStream.TestTWideStringComponentText; procedure TTestComponentStream.TestTWideStringComponentText;
Const Const
SData = SData11 =
'object TestTWideStringComponent: TWideStringComponent'+sLineBreak+ 'object TestTWideStringComponent: TWideStringComponent'+sLineBreak+
' WideStringProp = ''Some WideString'''+sLineBreak+ ' WideStringProp = ''Some WideString'''+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTWideStringComponent; TestTWideStringComponent;
CheckAsString(SData); CheckAsString(SData11);
end; end;
@ -1905,14 +1927,14 @@ end;
procedure TTestComponentStream.TestTDoubleComponentText; procedure TTestComponentStream.TestTDoubleComponentText;
Const Const
SData = SData12 =
'object TestTDoubleComponent: TDoubleComponent'+sLineBreak+ 'object TestTDoubleComponent: TDoubleComponent'+sLineBreak+
' DoubleProp = 2.3E+000'+sLineBreak+ ' DoubleProp = 2.3E+000'+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTDoubleComponent; TestTDoubleComponent;
CheckAsString(SData); CheckAsString(SData12);
end; end;
@ -1989,14 +2011,14 @@ end;
procedure TTestComponentStream.TestTCurrencyComponentTExt; procedure TTestComponentStream.TestTCurrencyComponentTExt;
Const Const
SData = SData13 =
'object TestTCurrencyComponent: TCurrencyComponent'+sLineBreak+ 'object TestTCurrencyComponent: TCurrencyComponent'+sLineBreak+
' CurrencyProp = 56700'+sLineBreak+ ' CurrencyProp = 56700'+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTCurrencyComponent; TestTCurrencyComponent;
CheckAsString(SData); CheckAsString(SData13);
end; end;
@ -2094,14 +2116,14 @@ end;
procedure TTestComponentStream.TestTEnumComponentText; procedure TTestComponentStream.TestTEnumComponentText;
Const Const
SData = SData14 =
'object TestTEnumComponent: TEnumComponent'+sLineBreak+ 'object TestTEnumComponent: TEnumComponent'+sLineBreak+
' Dice = four'+sLineBreak+ ' Dice = four'+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTEnumComponent; TestTEnumComponent;
CheckAsString(SData); CheckAsString(SData14);
end; end;
@ -2223,14 +2245,14 @@ end;
procedure TTestComponentStream.TestTSetComponentText; procedure TTestComponentStream.TestTSetComponentText;
Const Const
SData = SData15 =
'object TestTSetComponent: TSetComponent'+sLineBreak+ 'object TestTSetComponent: TSetComponent'+sLineBreak+
' Throw = [two, five]'+sLineBreak+ ' Throw = [two, five]'+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTSetComponent; TestTSetComponent;
CheckAsString(SData); CheckAsString(SData15);
end; end;
@ -2346,7 +2368,7 @@ end;
procedure TTestComponentStream.TestTMultipleComponentText; procedure TTestComponentStream.TestTMultipleComponentText;
Const Const
SData = SData16 =
'object TestTMultipleComponent: TMultipleComponent'+sLineBreak+ 'object TestTMultipleComponent: TMultipleComponent'+sLineBreak+
' IntProp = 1'+sLineBreak+ ' IntProp = 1'+sLineBreak+
' StringProp = ''A String'''+sLineBreak+ ' StringProp = ''A String'''+sLineBreak+
@ -2357,7 +2379,7 @@ Const
begin begin
TestTMultipleComponent; TestTMultipleComponent;
CheckAsString(SData); CheckAsString(SData16);
end; end;
@ -2388,7 +2410,7 @@ end;
procedure TTestComponentStream.TestTPersistentComponentText; procedure TTestComponentStream.TestTPersistentComponentText;
Const Const
SData = SData17 =
'object TestTPersistentComponent: TPersistentComponent'+sLineBreak+ 'object TestTPersistentComponent: TPersistentComponent'+sLineBreak+
' Persist.AInteger = 3'+sLineBreak+ ' Persist.AInteger = 3'+sLineBreak+
' Persist.AString = ''A persistent string'''+sLineBreak+ ' Persist.AString = ''A persistent string'''+sLineBreak+
@ -2396,7 +2418,7 @@ Const
begin begin
TestTPersistentComponent; TestTPersistentComponent;
CheckAsString(SData); CheckAsString(SData17);
end; end;
@ -2425,14 +2447,14 @@ end;
procedure TTestComponentStream.TestTCollectionComponentText; procedure TTestComponentStream.TestTCollectionComponentText;
Const Const
SData = SData18 =
'object TestTCollectionComponent: TCollectionComponent'+sLineBreak+ 'object TestTCollectionComponent: TCollectionComponent'+sLineBreak+
' Coll = <>'+sLineBreak+ ' Coll = <>'+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTCollectionComponent; TestTCollectionComponent;
CheckAsString(SData); CheckAsString(SData18);
end; end;
@ -2473,7 +2495,7 @@ end;
procedure TTestComponentStream.TestTCollectionComponent2Text; procedure TTestComponentStream.TestTCollectionComponent2Text;
Const Const
SData = SData19 =
'object TestTCollectionComponent2: TCollectionComponent2'+sLineBreak+ 'object TestTCollectionComponent2: TCollectionComponent2'+sLineBreak+
' Coll = < '+sLineBreak+ ' Coll = < '+sLineBreak+
' item'+sLineBreak+ ' item'+sLineBreak+
@ -2489,7 +2511,7 @@ Const
begin begin
TestTCollectionComponent2; TestTCollectionComponent2;
CheckAsString(SData); CheckAsString(SData19);
end; end;
@ -2614,14 +2636,14 @@ end;
procedure TTestComponentStream.TestTOwnedComponentText; procedure TTestComponentStream.TestTOwnedComponentText;
Const Const
SData = SData20 =
'object TestTOwnedComponent: TOwnedComponent'+sLineBreak+ 'object TestTOwnedComponent: TOwnedComponent'+sLineBreak+
' CompProp = SubComponent'+sLineBreak+ ' CompProp = SubComponent'+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTOwnedComponent; TestTOwnedComponent;
CheckAsString(SData); CheckAsString(SData20);
end; end;
@ -2655,7 +2677,7 @@ end;
procedure TTestComponentStream.TestTStreamedOwnedComponentText; procedure TTestComponentStream.TestTStreamedOwnedComponentText;
Const Const
SData = SData21 =
'object TestTStreamedOwnedComponent: TStreamedOwnedComponent'+sLineBreak+ 'object TestTStreamedOwnedComponent: TStreamedOwnedComponent'+sLineBreak+
' object Sub: TIntegerComponent'+sLineBreak+ ' object Sub: TIntegerComponent'+sLineBreak+
' IntProp = 3'+sLineBreak+ ' IntProp = 3'+sLineBreak+
@ -2664,7 +2686,7 @@ Const
begin begin
TestTStreamedOwnedComponent; TestTStreamedOwnedComponent;
CheckAsString(SData); CheckAsString(SData21);
end; end;
Procedure TTestComponentStream.TestTStreamedOwnedComponents; Procedure TTestComponentStream.TestTStreamedOwnedComponents;
@ -2704,7 +2726,7 @@ end;
procedure TTestComponentStream.TestTStreamedOwnedComponentsText; procedure TTestComponentStream.TestTStreamedOwnedComponentsText;
Const Const
SData = SData22 =
'object TestTStreamedOwnedComponents: TStreamedOwnedComponents'+sLineBreak+ 'object TestTStreamedOwnedComponents: TStreamedOwnedComponents'+sLineBreak+
' object SubA: TIntegerComponent'+sLineBreak+ ' object SubA: TIntegerComponent'+sLineBreak+
' IntProp = 3'+sLineBreak+ ' IntProp = 3'+sLineBreak+
@ -2716,7 +2738,7 @@ Const
begin begin
TestTStreamedOwnedComponents; TestTStreamedOwnedComponents;
CheckAsString(SData); CheckAsString(SData22);
end; end;
@ -2745,14 +2767,14 @@ end;
procedure TTestComponentStream.TestTMethodComponentText; procedure TTestComponentStream.TestTMethodComponentText;
Const Const
SData = SData23 =
'object TestTMethodComponent: TMethodComponent'+sLineBreak+ 'object TestTMethodComponent: TMethodComponent'+sLineBreak+
' MethodProp = MyMethod'+sLineBreak+ ' MethodProp = MyMethod'+sLineBreak+
'end'+sLineBreak; 'end'+sLineBreak;
begin begin
TestTMethodComponent; TestTMethodComponent;
CheckAsString(SData); CheckAsString(SData23);
end; end;
@ -2785,7 +2807,7 @@ end;
procedure TTestComponentStream.TestTMethodComponent2Text; procedure TTestComponentStream.TestTMethodComponent2Text;
Const Const
SData = SData24 =
'object TestTMethodComponent2: TMethodComponent2'+sLineBreak+ 'object TestTMethodComponent2: TMethodComponent2'+sLineBreak+
' object AComponent: TMethodComponent'+sLineBreak+ ' object AComponent: TMethodComponent'+sLineBreak+
' MethodProp = MyMethod2'+sLineBreak+ ' MethodProp = MyMethod2'+sLineBreak+
@ -2794,7 +2816,7 @@ Const
begin begin
TestTMethodComponent2; TestTMethodComponent2;
CheckAsString(SData); CheckAsString(SData24);
end; end;
@ -2917,5 +2939,5 @@ begin
end; end;
begin begin
RegisterTests([TTestComponentStream,TTestCollectionStream]); // RegisterTests([TTestComponentStream,TTestCollectionStream]);
end. end.

View File

@ -1,3 +1,24 @@
{ TStream classes tests.
Copyright (C) 2020 Michael Van Canneyt michael@freepascal.org
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version
with the following modification:
As a special exception, the copyright holders of this library give you permission to link this library with independent modules
to produce an executable, regardless of the license terms of these independent modules,and to copy and distribute the resulting
executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions
of the license of that module. An independent module is a module which is not derived from or based on this library. If you
modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do
not wish to do so, delete this exception statement from your version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA.
}
unit tcstream; unit tcstream;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}

View File

@ -1,3 +1,25 @@
{ Base class for component stream tests.
Copyright (C) 2020 Michael Van Canneyt michael@freepascal.org
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version
with the following modification:
As a special exception, the copyright holders of this library give you permission to link this library with independent modules
to produce an executable, regardless of the license terms of these independent modules,and to copy and distribute the resulting
executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions
of the license of that module. An independent module is a module which is not derived from or based on this library. If you
modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do
not wish to do so, delete this exception statement from your version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA.
}
{$mode objfpc} {$mode objfpc}
{$h+} {$h+}
unit tcstreaming; unit tcstreaming;

View File

@ -1243,6 +1243,6 @@ end;
initialization initialization
RegisterTest(TTestHelpers); // RegisterTest(TTestHelpers);
end. end.

1093
test/testcomps.pp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -76,7 +76,7 @@
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="11"/> <Version Value="11"/>
<Target FileExt=".js"> <Target>
<Filename Value="testrtl"/> <Filename Value="testrtl"/>
</Target> </Target>
<SearchPaths> <SearchPaths>

View File

@ -25,7 +25,7 @@ program testrtl;
{$mode objfpc} {$mode objfpc}
uses uses
browserconsole, consoletestrunner, frmrtlrun, browserconsole, consoletestrunner, frmrtlrun, strutils,
tcstream, tccompstreaming, simplelinkedlist, tcsyshelpers, tcstringhelp; tcstream, tccompstreaming, simplelinkedlist, tcsyshelpers, tcstringhelp;
var var