Browse Source

--- Merging r23341 into '.':
U packages/fcl-stl/src/gvector.pp
--- Merging r23411 into '.':
C packages/fcl-image/src/fpcanvas.pp (resolved, no netto change)
--- Merging r24163 into '.':
U packages/fcl-fpcunit/src/plaintestreport.pp
U packages/fcl-fpcunit/src/consoletestrunner.pas
U packages/fcl-fpcunit/src/fpcunitreport.pp
U packages/fcl-fpcunit/src/latextestreport.pp
--- Merging r24170 into '.':
U packages/fcl-fpcunit/src/xmlreporter.pas
U packages/fcl-fpcunit/src/xmltestreport.pp
--- Merging r24172 into '.':
G packages/fcl-fpcunit/src/xmlreporter.pas
Summary of conflicts:
Text conflicts: 1

# revisions: 23341,23411,24163,24170,24172,
r23341 | michael | 2013-01-07 16:55:48 +0100 (Mon, 07 Jan 2013) | 1 line
Changed paths:
M /trunk/packages/fcl-stl/src/gvector.pp

* Patch from Denis Volodarsky to add enumerator to vector (bug ID #22689)
r23411 | sekelsenmat | 2013-01-16 16:10:42 +0100 (Wed, 16 Jan 2013) | 1 line
Changed paths:
M /trunk/packages/fcl-image/src/fpcanvas.pp

Fixes a spelling mistake in TFPCustomFont
r24163 | michael | 2013-04-06 14:35:34 +0200 (Sat, 06 Apr 2013) | 1 line
Changed paths:
M /trunk/packages/fcl-fpcunit/src/consoletestrunner.pas
M /trunk/packages/fcl-fpcunit/src/fpcunitreport.pp
M /trunk/packages/fcl-fpcunit/src/latextestreport.pp
M /trunk/packages/fcl-fpcunit/src/plaintestreport.pp

* Added SkipTimings option
r24170 | michael | 2013-04-07 10:24:22 +0200 (Sun, 07 Apr 2013) | 1 line
Changed paths:
M /trunk/packages/fcl-fpcunit/src/xmlreporter.pas
M /trunk/packages/fcl-fpcunit/src/xmltestreport.pp

* SkipTiming by Reinier
r24172 | michael | 2013-04-07 12:10:16 +0200 (Sun, 07 Apr 2013) | 1 line
Changed paths:
M /trunk/packages/fcl-fpcunit/src/xmlreporter.pas

* Fix compilation

git-svn-id: branches/fixes_2_6@24540 -

marco 12 years ago
parent
commit
0670d9b946

+ 13 - 8
packages/fcl-fpcunit/src/consoletestrunner.pas

@@ -29,10 +29,10 @@ uses
   dom;
   dom;
 
 
 const
 const
-  Version = '0.2';
+  Version = '0.3';
 
 
 type
 type
-  TFormat = (fPlain, fLatex, fXML);
+  TFormat = (fPlain, fLatex, fXML, fPlainNoTiming);
 
 
 var
 var
   DefaultFormat : TFormat = fXML;
   DefaultFormat : TFormat = fXML;
@@ -73,8 +73,8 @@ uses testdecorator;
 
 
 const
 const
   ShortOpts = 'alhp';
   ShortOpts = 'alhp';
-  DefaultLongOpts: array[1..8] of string =
-     ('all', 'list', 'progress', 'help',
+  DefaultLongOpts: array[1..9] of string =
+     ('all', 'list', 'progress', 'help', 'skiptiming',
       'suite:', 'format:', 'file:', 'stylesheet:');
       'suite:', 'format:', 'file:', 'stylesheet:');
 
 
   { TProgressWriter }
   { TProgressWriter }
@@ -145,14 +145,15 @@ end;
 function TTestRunner.GetResultsWriter: TCustomResultsWriter;
 function TTestRunner.GetResultsWriter: TCustomResultsWriter;
 begin
 begin
   case FormatParam of
   case FormatParam of
-    fLatex: Result := TLatexResultsWriter.Create(nil);
-    fPlain: Result := TPlainResultsWriter.Create(nil);
+    fLatex:         Result := TLatexResultsWriter.Create(nil);
+    fPlain:         Result := TPlainResultsWriter.Create(nil);
   else
   else
     begin
     begin
       Result := TXmlResultsWriter.Create(nil);
       Result := TXmlResultsWriter.Create(nil);
       ExtendXmlDocument(TXMLResultsWriter(Result).Document);
       ExtendXmlDocument(TXMLResultsWriter(Result).Document);
     end;
     end;
   end;
   end;
+  Result.SkipTiming:=HasOption('skiptiming');
 end;
 end;
 
 
 procedure TTestRunner.DoTestRun(ATest: TTest);
 procedure TTestRunner.DoTestRun(ATest: TTest);
@@ -211,6 +212,7 @@ begin
     writeln('  --format=latex            output as latex source (only list implemented)');
     writeln('  --format=latex            output as latex source (only list implemented)');
     writeln('  --format=plain            output as plain ASCII source');
     writeln('  --format=plain            output as plain ASCII source');
     writeln('  --format=xml              output as XML source (default)');
     writeln('  --format=xml              output as XML source (default)');
+    writeln('  --skiptiming              Do not output timings (useful for diffs of testruns)');
     writeln('  --stylesheet=<reference>   add stylesheet reference');
     writeln('  --stylesheet=<reference>   add stylesheet reference');
     writeln('  --file=<filename>         output results to file');
     writeln('  --file=<filename>         output results to file');
     writeln;
     writeln;
@@ -232,6 +234,8 @@ begin
       FormatParam := fLatex
       FormatParam := fLatex
     else if CompareText(GetOptionValue('format'),'plain')=0 then
     else if CompareText(GetOptionValue('format'),'plain')=0 then
       FormatParam := fPlain
       FormatParam := fPlain
+    else if CompareText(GetOptionValue('format'),'plainnotiming')=0 then
+      FormatParam := fPlainNoTiming
     else if CompareText(GetOptionValue('format'),'xml')=0 then
     else if CompareText(GetOptionValue('format'),'xml')=0 then
       FormatParam := fXML;
       FormatParam := fXML;
   end;
   end;
@@ -369,8 +373,9 @@ begin
   //get a list of all registed tests
   //get a list of all registed tests
   if HasOption('l', 'list') then
   if HasOption('l', 'list') then
     case FormatParam of
     case FormatParam of
-      fLatex: Write(GetSuiteAsLatex(GetTestRegistry));
-      fPlain: Write(GetSuiteAsPlain(GetTestRegistry));
+      fLatex:         Write(GetSuiteAsLatex(GetTestRegistry));
+      fPlain:         Write(GetSuiteAsPlain(GetTestRegistry));
+      fPlainNoTiming: Write(GetSuiteAsPlain(GetTestRegistry));
     else
     else
       Write(GetSuiteAsLatex(GetTestRegistry));;
       Write(GetSuiteAsLatex(GetTestRegistry));;
     end;
     end;

+ 4 - 0
packages/fcl-fpcunit/src/fpcunitreport.pp

@@ -62,6 +62,8 @@ type
     procedure IncrementIgnores;
     procedure IncrementIgnores;
   end;
   end;
 
 
+  { TCustomResultsWriter }
+
   TCustomResultsWriter = class(TComponent, ITestListener)
   TCustomResultsWriter = class(TComponent, ITestListener)
   private
   private
     FLevel: integer;
     FLevel: integer;
@@ -79,6 +81,7 @@ type
     FOnEndTest: TTestEvent;
     FOnEndTest: TTestEvent;
     FOnStartTestSuite: TTestEvent;
     FOnStartTestSuite: TTestEvent;
     FOnEndTestSuite: TTestEvent;
     FOnEndTestSuite: TTestEvent;
+    FSkipTiming: Boolean;
   protected
   protected
     procedure WriteTestHeader(ATest: TTest; ALevel: integer; ACount: integer); virtual;
     procedure WriteTestHeader(ATest: TTest; ALevel: integer; ACount: integer); virtual;
     procedure WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime); virtual;
     procedure WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime); virtual;
@@ -118,6 +121,7 @@ type
     property OnEndTest: TTestEvent read FOnEndTest write FOnEndTest;
     property OnEndTest: TTestEvent read FOnEndTest write FOnEndTest;
     property OnStartTestSuite: TTestEvent read FOnStartTestSuite write FOnStartTestSuite;
     property OnStartTestSuite: TTestEvent read FOnStartTestSuite write FOnStartTestSuite;
     property OnEndTestSuite: TTestEvent read FOnEndTestSuite write FOnEndTestSuite;
     property OnEndTestSuite: TTestEvent read FOnEndTestSuite write FOnEndTestSuite;
+    Property SkipTiming : Boolean Read FSkipTiming Write FSkipTiming;
   end; 
   end; 
 
 
 implementation
 implementation

+ 16 - 5
packages/fcl-fpcunit/src/latextestreport.pp

@@ -154,10 +154,16 @@ begin
 end;
 end;
 
 
 procedure TLatexResultsWriter.WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime);
 procedure TLatexResultsWriter.WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime);
+
+Var
+  S : String;
 begin
 begin
   inherited;
   inherited;
-  FDoc.Add(StringOfChar(' ',ALevel*2)+ '  '+ '\item[-] ' + FormatDateTime('ss.zzz', ATiming)  
-    + '  ' + EscapeText(ATest.TestName));
+  S:=StringOfChar(' ',ALevel*2)+ '  '+ '\item[-] ';
+  if Not SkipTiming then
+    S:=S+FormatDateTime('ss.zzz', ATiming);
+  S:=S+ '  ' + EscapeText(ATest.TestName);
+  FDoc.Add(S);
   if Assigned(FTempFailure) then
   if Assigned(FTempFailure) then
   begin
   begin
     //check if it's an error 
     //check if it's an error 
@@ -200,13 +206,18 @@ procedure TLatexResultsWriter.WriteSuiteFooter(ATestSuite: TTestSuite; ALevel: i
   ANumIgnores: integer);
   ANumIgnores: integer);
 var
 var
   idx: integer;
   idx: integer;
+  S : String;
+
 begin
 begin
   inherited;
   inherited;
   FDoc.Add(StringOfChar(' ',ALevel*2)+ ' \end{itemize}');
   FDoc.Add(StringOfChar(' ',ALevel*2)+ ' \end{itemize}');
   idx := Integer(FSuiteHeaderIdx[FSuiteHeaderIdx.Count -1]);
   idx := Integer(FSuiteHeaderIdx[FSuiteHeaderIdx.Count -1]);
-  FDoc[idx] := FDoc[idx] + ' {\color{Blue}'+ '  Time:'+ FormatDateTime('ss.zzz', ATiming)+
-    ' N:'+ IntToStr(ANumRuns)+ ' E:'+ IntToStr(ANumErrors)+ ' F:'+ IntToStr(ANumFailures)+ 
-    ' I:'+ IntToStr(ANumIgnores)+'}';
+  S:= ' {\color{Blue}';
+  if Not SkipTiming then
+    S:=S+ ' Time: '+FormatDateTime('ss.zzz', ATiming);
+  S:=S+' N:'+ IntToStr(ANumRuns)+ ' E:'+ IntToStr(ANumErrors)+ ' F:'+ IntToStr(ANumFailures)+
+  ' I:'+ IntToStr(ANumIgnores)+'}';
+  FDoc[idx] := FDoc[idx] +S;
   FSuiteHeaderIdx.Delete(FSuiteHeaderIdx.Count -1);
   FSuiteHeaderIdx.Delete(FSuiteHeaderIdx.Count -1);
 end;
 end;
 
 

+ 15 - 5
packages/fcl-fpcunit/src/plaintestreport.pp

@@ -102,10 +102,17 @@ begin
 end;
 end;
 
 
 procedure TPlainResultsWriter.WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime);
 procedure TPlainResultsWriter.WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime);
+
+Var
+  S : String;
+
 begin
 begin
   inherited;
   inherited;
-  FDoc.Add('  ' + StringOfChar(' ',ALevel*2) +  FormatDateTime('ss.zzz', ATiming) + '  ' 
-    + ATest.TestName);
+  S:='  ' + StringOfChar(' ',ALevel*2);
+  if Not SkipTiming then
+    S:=S + FormatDateTime('ss.zzz', ATiming) + '  ';
+  S:=S + ATest.TestName;
+  FDoc.Add(S);
   if Assigned(FTempFailure) then
   if Assigned(FTempFailure) then
   begin
   begin
     //check if it's an error 
     //check if it's an error 
@@ -137,12 +144,15 @@ procedure TPlainResultsWriter.WriteSuiteFooter(ATestSuite: TTestSuite; ALevel: i
   ANumIgnores: integer);
   ANumIgnores: integer);
 var
 var
   idx: integer;
   idx: integer;
+  S: String;
 begin
 begin
   inherited;
   inherited;
   idx := Integer(FSuiteHeaderIdx[FSuiteHeaderIdx.Count -1]);
   idx := Integer(FSuiteHeaderIdx[FSuiteHeaderIdx.Count -1]);
-  FDoc[idx] := FDoc[idx] + ' Time:'+ FormatDateTime('ss.zzz', ATiming)+
-    ' N:'+ IntToStr(ANumRuns)+ ' E:'+ IntToStr(ANumErrors)+ ' F:'+ IntToStr(ANumFailures)+ 
-    ' I:'+ IntToStr(ANumIgnores);
+  if Not SkipTiming then
+    S:= ' Time:'+ FormatDateTime('ss.zzz', ATiming);
+  S:=S+ ' N:'+ IntToStr(ANumRuns)+ ' E:'+ IntToStr(ANumErrors)+ ' F:'+ IntToStr(ANumFailures)+
+    ' I:'+ IntToStr(ANumIgnores) ;
+  FDoc[idx] := FDoc[idx]+S;
   FSuiteHeaderIdx.Delete(FSuiteHeaderIdx.Count -1);
   FSuiteHeaderIdx.Delete(FSuiteHeaderIdx.Count -1);
 end;
 end;
 
 

+ 20 - 11
packages/fcl-fpcunit/src/xmlreporter.pas

@@ -18,10 +18,10 @@
   
   
 
 
   Purpose:
   Purpose:
-    This unit contains a XML TestListener for use with the fpcUnit testing
-    framework.  It uses the XMLWrite unit, which is part of FPC, to generate
-    the XML document. The benefit of using the XMLWrite unit, is that the
-    data generated is valid XML, with resevered characters correctly escaped.
+    This unit contains an XML TestListener for use with the fpcUnit testing
+    framework. It uses the XMLWrite unit, which is part of FPC, to generate
+    the XML document. The benefit of using the XMLWrite unit is that the
+    data generated is valid XML, with reserved characters correctly escaped.
     This allows the XML document to be further processed with XSLT etc without
     This allows the XML document to be further processed with XSLT etc without
     any issues.
     any issues.
 
 
@@ -43,7 +43,7 @@ uses
   
   
 
 
 type
 type
-  { XML Test Listner }
+  { XML Test Listener }
 
 
   { TXMLResultsWriter }
   { TXMLResultsWriter }
 
 
@@ -58,6 +58,7 @@ type
     FErrors: TDOMNode;
     FErrors: TDOMNode;
     FLastTestSuite: TDOMNode;
     FLastTestSuite: TDOMNode;
     FStartCrono: TDateTime;
     FStartCrono: TDateTime;
+    FskipTiming : Boolean;
     { Converts the actual test results into XML nodes. This gets called
     { Converts the actual test results into XML nodes. This gets called
       by the public method WriteResult. }
       by the public method WriteResult. }
     procedure   TestResultAsXML(pTestResult: TTestResult);
     procedure   TestResultAsXML(pTestResult: TTestResult);
@@ -78,6 +79,7 @@ type
 
 
     { A public property to the internal XML document }
     { A public property to the internal XML document }
     property    Document: TXMLDocument read FDoc;
     property    Document: TXMLDocument read FDoc;
+    Property    SkipTiming : Boolean Read FSkipTiming Write FSkipTiming;
   end;
   end;
 
 
 
 
@@ -107,9 +109,13 @@ begin
   n.AppendChild(FDoc.CreateTextNode(IntToStr(pTestResult.NumberOfIgnoredTests)));
   n.AppendChild(FDoc.CreateTextNode(IntToStr(pTestResult.NumberOfIgnoredTests)));
   lResults.AppendChild(n);
   lResults.AppendChild(n);
 
 
-  n := FDoc.CreateElement('TotalElapsedTime');
-  n.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', Now - pTestResult.StartingTime)));
-  lResults.AppendChild(n);
+  { We don't have access to TCustomResultsWriter so we cannot honour SkipTiming}
+  if not(SkipTiming) then
+  begin
+    n := FDoc.CreateElement('TotalElapsedTime');
+    n.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', Now - pTestResult.StartingTime)));
+    lResults.AppendChild(n);
+  end;
 
 
   { Summary of ISO 8601  http://www.cl.cam.ac.uk/~mgk25/iso-time.html }
   { Summary of ISO 8601  http://www.cl.cam.ac.uk/~mgk25/iso-time.html }
   n := FDoc.CreateElement('DateTimeRan');
   n := FDoc.CreateElement('DateTimeRan');
@@ -244,9 +250,12 @@ var
   lNew: TDOMElement;
   lNew: TDOMElement;
 begin
 begin
   n := FLastTestSuite.LastChild;
   n := FLastTestSuite.LastChild;
-  lNew := FDoc.CreateElement('ElapsedTime');
-  lNew.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', Now - FStartCrono)));
-  n.AppendChild(lNew);
+  if not(SkipTiming) then
+  begin
+    lNew := FDoc.CreateElement('ElapsedTime');
+    lNew.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', Now - FStartCrono)));
+    n.AppendChild(lNew);
+  end;
 end;
 end;
 
 
 procedure TXMLResultsWriter.StartTestSuite(ATestSuite: TTestSuite);
 procedure TXMLResultsWriter.StartTestSuite(ATestSuite: TTestSuite);

+ 11 - 6
packages/fcl-fpcunit/src/xmltestreport.pp

@@ -129,7 +129,8 @@ end;
 procedure TXMLResultsWriter.WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime);
 procedure TXMLResultsWriter.WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime);
 begin
 begin
   inherited;
   inherited;
-  FCurrentTest['ElapsedTime'] := FormatDateTime('hh:nn:ss.zzz', ATiming);
+  if not SkipTiming then
+    FCurrentTest['ElapsedTime'] := FormatDateTime('hh:nn:ss.zzz', ATiming);
 end;
 end;
 
 
 
 
@@ -156,7 +157,8 @@ var
 begin
 begin
   inherited;
   inherited;
   n := TDomElement(FSuitePath[FSuitePath.Count -1]);
   n := TDomElement(FSuitePath[FSuitePath.Count -1]);
-  n['ElapsedTime'] := FormatDateTime('hh:nn:ss.zzz', ATiming);
+  if not SkipTiming then
+    n['ElapsedTime'] := FormatDateTime('hh:nn:ss.zzz', ATiming);
   n['NumberOfRunTests'] := IntToStr(ANumRuns);
   n['NumberOfRunTests'] := IntToStr(ANumRuns);
   n['NumberOfErrors'] := IntToStr(ANumErrors);
   n['NumberOfErrors'] := IntToStr(ANumErrors);
   n['NumberOfFailures'] := IntToStr(ANumFailures);
   n['NumberOfFailures'] := IntToStr(ANumFailures);
@@ -267,10 +269,13 @@ begin
   n.AppendChild(FDoc.CreateTextNode(IntToStr(aResult.NumberOfIgnoredTests)));
   n.AppendChild(FDoc.CreateTextNode(IntToStr(aResult.NumberOfIgnoredTests)));
   lResults.AppendChild(n);
   lResults.AppendChild(n);
 
 
-  n := FDoc.CreateElement('TotalElapsedTime');
-  n.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', 
-    Now - aResult.StartingTime)));
-  lResults.AppendChild(n);     
+  if not SkipTiming then
+  begin
+    n := FDoc.CreateElement('TotalElapsedTime');
+    n.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz',
+      Now - aResult.StartingTime)));
+    lResults.AppendChild(n);
+  end;
 
 
   { Summary of ISO 8601  http://www.cl.cam.ac.uk/~mgk25/iso-time.html }
   { Summary of ISO 8601  http://www.cl.cam.ac.uk/~mgk25/iso-time.html }
   n := FDoc.CreateElement('DateTimeRan');
   n := FDoc.CreateElement('DateTimeRan');

+ 77 - 26
packages/fcl-stl/src/gvector.pp

@@ -17,33 +17,57 @@ unit gvector;
 interface
 interface
 
 
 type
 type
-  generic TVector<T>=class
+
+  { TVector }
+
+  generic TVector<T> = class
   private
   private
   type
   type
-    PT=^ T;
-    TArr=array of T;
+    PT = ^ T;
+    TArr = array of T;
   var
   var
     FCapacity:SizeUInt;
     FCapacity:SizeUInt;
     FDataSize:SizeUInt;
     FDataSize:SizeUInt;
     FData:TArr;
     FData:TArr;
 
 
-    procedure SetValue(Position:SizeUInt; Value:T);inline;
-    function GetValue(Position:SizeUInt):T;inline;
-    function GetMutable(Position:SizeUInt):PT;inline;
-    procedure IncreaseCapacity;inline;
+    procedure SetValue(Position: SizeUInt; const Value: T); inline;
+    function GetValue(Position: SizeUInt):T; inline;
+    function GetMutable(Position: SizeUInt):PT; inline;
+    procedure IncreaseCapacity; inline;
+
+  const
+    // todo: move these constants to implementation when
+    // mantis #0021310 will be fixed.
+    SVectorPositionOutOfRange      = 'Vector position out of range';
+    SAccessingElementOfEmptyVector = 'Accessing element of empty vector';
+
+  type
+    TVectorEnumerator = class
+    private
+      FVector: TVector;
+      FPosition: Integer;
+    public
+      constructor Create(AVector: TVector);
+      function GetCurrent: T; inline;
+      function MoveNext: Boolean; inline;
+      property Current: T read GetCurrent;
+    end;
+
   public
   public
     constructor Create;
     constructor Create;
-    function Size:SizeUInt;inline;
-    procedure PushBack(Value:T);inline;
-    procedure PopBack;inline;
-    function IsEmpty:boolean;inline;
-    procedure Insert(Position:SizeUInt; Value:T);inline;
-    procedure Erase(Position:SizeUInt);inline;
-    procedure Clear;inline;
-    function Front:T;inline;
-    function Back:T;inline;
-    procedure Reserve(Num:SizeUInt);inline;
-    procedure Resize(Num:SizeUInt);inline;
+    function Size: SizeUInt; inline;
+    procedure PushBack(const Value: T); inline;
+    procedure PopBack; inline;
+    function IsEmpty: boolean; inline;
+    procedure Insert(Position: SizeUInt; const Value: T); inline;
+    procedure Erase(Position: SizeUInt); inline;
+    procedure Clear; inline;
+    function Front: T; inline;
+    function Back: T; inline;
+    procedure Reserve(Num: SizeUInt); inline;
+    procedure Resize(Num: SizeUInt); inline;
+
+    function GetEnumerator: TVectorEnumerator;
 
 
     property Items[i : SizeUInt]: T read getValue write setValue; default;
     property Items[i : SizeUInt]: T read getValue write setValue; default;
     property Mutable[i : SizeUInt]: PT read getMutable;
     property Mutable[i : SizeUInt]: PT read getMutable;
@@ -51,39 +75,61 @@ end;
 
 
 implementation
 implementation
 
 
+{ TVector.TVectorEnumerator }
+
+constructor TVector.TVectorEnumerator.Create(AVector: TVector);
+begin
+  FVector := AVector;
+  FPosition := -1;
+end;
+
+function TVector.TVectorEnumerator.GetCurrent: T;
+begin
+  Result := FVector[FPosition];
+end;
+
+function TVector.TVectorEnumerator.MoveNext: Boolean;
+begin
+  Result := FPosition < FVector.Size - 1;
+  if Result then
+    inc(FPosition);
+end;
+
+{ TVector }
+
 constructor TVector.Create();
 constructor TVector.Create();
 begin
 begin
   FCapacity:=0;
   FCapacity:=0;
   FDataSize:=0;
   FDataSize:=0;
 end;
 end;
 
 
-procedure TVector.SetValue(Position:SizeUInt; Value:T);inline;
+procedure TVector.SetValue(Position: SizeUInt; const Value: T);
 begin
 begin
-  Assert(position < size, 'Vector position out of range');
+  Assert(position < size, SVectorPositionOutOfRange);
   FData[Position]:=Value;
   FData[Position]:=Value;
 end;
 end;
 
 
 function TVector.GetValue(Position:SizeUInt):T;inline;
 function TVector.GetValue(Position:SizeUInt):T;inline;
 begin
 begin
-  Assert(position < size, 'Vector position out of range');
+  Assert(position < size, SVectorPositionOutOfRange);
   GetValue:=FData[Position];
   GetValue:=FData[Position];
 end;
 end;
 
 
 function TVector.GetMutable(Position:SizeUInt):PT;inline;
 function TVector.GetMutable(Position:SizeUInt):PT;inline;
 begin
 begin
-  Assert(position < size, 'Vector position out of range');
+  Assert(position < size, SVectorPositionOutOfRange);
   GetMutable:=@FData[Position];
   GetMutable:=@FData[Position];
 end;
 end;
 
 
 function TVector.Front():T;inline;
 function TVector.Front():T;inline;
 begin
 begin
-  Assert(size > 0, 'Accessing element of empty vector');
+  Assert(size > 0, SAccessingElementOfEmptyVector);
   Front:=FData[0];
   Front:=FData[0];
 end;
 end;
 
 
 function TVector.Back():T;inline;
 function TVector.Back():T;inline;
 begin
 begin
-  Assert(size > 0, 'Accessing element of empty vector');
+  Assert(size > 0, SAccessingElementOfEmptyVector);
   Back:=FData[FDataSize-1];
   Back:=FData[FDataSize-1];
 end;
 end;
 
 
@@ -100,7 +146,7 @@ begin
     IsEmpty:=false;
     IsEmpty:=false;
 end;
 end;
 
 
-procedure TVector.PushBack(Value:T);inline;
+procedure TVector.PushBack(const Value: T);
 begin
 begin
   if FDataSize=FCapacity then
   if FDataSize=FCapacity then
     IncreaseCapacity;
     IncreaseCapacity;
@@ -117,13 +163,18 @@ begin
   SetLength(FData, FCapacity);
   SetLength(FData, FCapacity);
 end;
 end;
 
 
+function TVector.GetEnumerator: TVectorEnumerator;
+begin
+  Result := TVectorEnumerator.Create(self);
+end;
+
 procedure TVector.PopBack();inline;
 procedure TVector.PopBack();inline;
 begin
 begin
   if FDataSize>0 then
   if FDataSize>0 then
     FDataSize:=FDataSize-1;
     FDataSize:=FDataSize-1;
 end;
 end;
 
 
-procedure TVector.Insert(Position:SizeUInt; Value: T);inline;
+procedure TVector.Insert(Position: SizeUInt; const Value: T);
 var i:SizeUInt;
 var i:SizeUInt;
 begin
 begin
   pushBack(Value);
   pushBack(Value);