From c72c0faa30db2e38b8424e40951df8cae6719bb6 Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 7 Jun 2020 15:36:14 +0000 Subject: [PATCH] * Stack is enumerated from bottom up --- packages/rtl/generics.collections.pas | 2 +- test/tcgenericstack.pp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/rtl/generics.collections.pas b/packages/rtl/generics.collections.pas index 4c5212d..a12590f 100644 --- a/packages/rtl/generics.collections.pas +++ b/packages/rtl/generics.collections.pas @@ -314,7 +314,7 @@ type { TEnumerator } - TEnumerator = class(TCustomInvertedListEnumerator) + TEnumerator = class(TCustomListEnumerator) public constructor Create(AStack: TMyType); end; diff --git a/test/tcgenericstack.pp b/test/tcgenericstack.pp index c0461b9..d232975 100644 --- a/test/tcgenericstack.pp +++ b/test/tcgenericstack.pp @@ -357,7 +357,7 @@ begin For I:=1 to 3 do begin SI:=IntToStr(I); - AssertEquals('Value '+SI,SI,A[3-i]); + AssertEquals('Value '+SI,SI,A[i-1]); end; end; @@ -371,12 +371,12 @@ Var begin DoAdd(3); - I:=3; + I:=1; For A in Stack do begin SI:=IntToStr(i); AssertEquals('Value '+SI,SI,A); - Dec(I); + Inc(I); end; end; @@ -392,7 +392,7 @@ procedure TTestSimpleStack.TestValueNotificationDelete; begin DoAdd(3); Stack.OnNotify:=@DoValueNotify; - SetExpectValues('Clear',['3','2','1'],[cnRemoved,cnRemoved,cnRemoved],{$IFDEF FPC}true{$ELSE}False{$endif}); + SetExpectValues('Clear',['3','2','1'],[cnRemoved,cnRemoved,cnRemoved],False); Stack.Clear; DoneExpectValues; end;