Refactoring IState - ISignal

This commit is contained in:
Michael Schimmel
2025-06-24 09:24:37 +02:00
parent a3da63ad6a
commit 6ea0f94e36
11 changed files with 120 additions and 118 deletions
+11 -11
View File
@@ -150,7 +150,7 @@ var
begin
sourceDirty := TFlag.CreateFlag;
sourceDirty.Reset;
funcLazy := TMycFuncLazy<Integer>.Create(sourceDirty.State, function: Integer begin Result := 10; end);
funcLazy := TMycFuncLazy<Integer>.Create(sourceDirty.State.Signal, function: Integer begin Result := 10; end);
Assert.IsNotNull(funcLazy, 'TMycFuncLazy<Integer> instance should not be nil');
changedState := funcLazy.GetChanged;
Assert.IsNotNull(changedState, 'funcLazy.GetChanged should return a valid TState.IState');
@@ -172,7 +172,7 @@ begin
expectedValue := 50;
funcLazy :=
TMycFuncLazy<Integer>.Create(
sourceDirty.State,
sourceDirty.State.Signal,
function: Integer
begin
procExecuted := True;
@@ -200,7 +200,7 @@ begin
sourceDirty := TFlag.CreateFlag;
sourceDirty.Reset;
initialProcValue := 33;
funcLazy := TMycFuncLazy<Integer>.Create(sourceDirty.State, function: Integer begin Result := initialProcValue; end);
funcLazy := TMycFuncLazy<Integer>.Create(sourceDirty.State.Signal, function: Integer begin Result := initialProcValue; end);
Helper_ConsumeInitialPop(funcLazy, initialProcValue);
Assert.IsFalse(funcLazy.GetChanged.IsSet, 'After initial Pop and no source change, GetChanged.IsSet should be false');
end;
@@ -220,7 +220,7 @@ begin
procExecutedCount := 0;
funcLazy :=
TMycFuncLazy<Integer>.Create(
sourceDirty.State,
sourceDirty.State.Signal,
function: Integer
begin
Inc(procExecutedCount);
@@ -244,7 +244,7 @@ begin
sourceDirty := TFlag.CreateFlag;
sourceDirty.Reset;
initialProcValue := 20;
funcLazy := TMycFuncLazy<Integer>.Create(sourceDirty.State, function: Integer begin Result := initialProcValue; end);
funcLazy := TMycFuncLazy<Integer>.Create(sourceDirty.State.Signal, function: Integer begin Result := initialProcValue; end);
Helper_ConsumeInitialPop(funcLazy, initialProcValue);
sourceDirty.Notify;
changedState := funcLazy.GetChanged;
@@ -265,7 +265,7 @@ begin
procCallCount := 0;
funcLazy :=
TMycFuncLazy<Integer>.Create(
sourceDirty.State,
sourceDirty.State.Signal,
function: Integer
begin
Inc(procCallCount);
@@ -302,7 +302,7 @@ begin
procCallCount := 0;
funcLazy :=
TMycFuncLazy<Integer>.Create(
sourceDirty.State,
sourceDirty.State.Signal,
function: Integer
begin
Inc(procCallCount);
@@ -338,7 +338,7 @@ begin
funcLazy :=
TMycFuncLazy<Integer>.Create(
sourceDirty.State,
sourceDirty.State.Signal,
function: Integer
begin
Inc(procCallCount);
@@ -391,7 +391,7 @@ var
begin
sourceDirty := TFlag.CreateFlag;
sourceDirty.Reset;
funcLazyObj := TMycFuncLazy<Integer>.Create(sourceDirty.State, function: Integer begin Result := 1; end);
funcLazyObj := TMycFuncLazy<Integer>.Create(sourceDirty.State.Signal, function: Integer begin Result := 1; end);
Assert.IsTrue(funcLazyObj.Pop(tempVal), 'Initial Pop should succeed');
funcLazyObj.Destroy;
Assert.WillNotRaise(
@@ -411,13 +411,13 @@ var
expectedValue: Integer;
procExecuted: Boolean;
begin
sourceDirty := TFlag.CreateFlag;
sourceDirty := TFlag.CreateFlag( true );
Assert.IsTrue(sourceDirty.State.IsSet, 'SourceDirty should be initially set for this test scenario');
expectedValue := 70;
procExecuted := False;
funcLazy :=
TMycFuncLazy<Integer>.Create(
sourceDirty.State,
sourceDirty.State.Signal,
function: Integer
begin
procExecuted := True;