Test Refactoring of signals

This commit is contained in:
Michael Schimmel
2025-06-05 22:11:54 +02:00
parent c9817ca200
commit e06a023742
17 changed files with 528 additions and 774 deletions
+22 -22
View File
@@ -162,9 +162,9 @@ procedure TTestMycCoreLazy.TestFuncLazy_GetChanged_IsAlwaysTrueAfterCreation;
var
funcLazy: IMycLazy<Integer>;
changedState: IMycState;
sourceDirty: IMycDirty;
sourceDirty: IMycFlag;
begin
sourceDirty := TDirty.Construct;
sourceDirty := TFlag.CreateFlag;
sourceDirty.Reset;
funcLazy := TMycFuncLazy<Integer>.Create(sourceDirty.State, function: Integer begin Result := 10; end);
Assert.IsNotNull(funcLazy, 'TMycFuncLazy<Integer> instance should not be nil');
@@ -178,11 +178,11 @@ var
funcLazy: IMycLazy<Integer>;
value: Integer;
result: Boolean;
sourceDirty: IMycDirty;
sourceDirty: IMycFlag;
procExecuted: Boolean;
expectedValue: Integer;
begin
sourceDirty := TDirty.Construct;
sourceDirty := TFlag.CreateFlag;
sourceDirty.Reset;
procExecuted := False;
expectedValue := 50;
@@ -211,9 +211,9 @@ var
value: Integer;
preCallValue: Integer;
result: Boolean;
sourceDirty: IMycDirty;
sourceDirty: IMycFlag;
begin
sourceDirty := TDirty.Construct;
sourceDirty := TFlag.CreateFlag;
sourceDirty.Reset;
funcLazy := TMycFuncLazy<Integer>.Create(sourceDirty.State, nil);
Assert.IsNotNull(funcLazy, 'TMycFuncLazy<Integer> instance should not be nil');
@@ -235,10 +235,10 @@ end;
procedure TTestMycCoreLazy.TestFuncLazy_AfterFirstPop_IfNoSourceChange_GetChangedIsFalse;
var
funcLazy: IMycLazy<Integer>;
sourceDirty: IMycDirty;
sourceDirty: IMycFlag;
initialProcValue: Integer;
begin
sourceDirty := TDirty.Construct;
sourceDirty := TFlag.CreateFlag;
sourceDirty.Reset;
initialProcValue := 33;
funcLazy := TMycFuncLazy<Integer>.Create(sourceDirty.State, function: Integer begin Result := initialProcValue; end);
@@ -251,11 +251,11 @@ var
funcLazy: IMycLazy<Integer>;
value: Integer;
result: Boolean;
sourceDirty: IMycDirty;
sourceDirty: IMycFlag;
initialProcValue: Integer;
procExecutedCount: Integer;
begin
sourceDirty := TDirty.Construct;
sourceDirty := TFlag.CreateFlag;
sourceDirty.Reset;
initialProcValue := 44;
procExecutedCount := 0;
@@ -279,10 +279,10 @@ procedure TTestMycCoreLazy.TestFuncLazy_AfterSourceChange_GetChanged_IsSet;
var
funcLazy: IMycLazy<Integer>;
changedState: IMycState;
sourceDirty: IMycDirty;
sourceDirty: IMycFlag;
initialProcValue: Integer;
begin
sourceDirty := TDirty.Construct;
sourceDirty := TFlag.CreateFlag;
sourceDirty.Reset;
initialProcValue := 20;
funcLazy := TMycFuncLazy<Integer>.Create(sourceDirty.State, function: Integer begin Result := initialProcValue; end);
@@ -297,11 +297,11 @@ var
funcLazy: IMycLazy<Integer>;
value: Integer;
result: Boolean;
sourceDirty: IMycDirty;
sourceDirty: IMycFlag;
procCallCount: Integer;
currentExpectedValue: Integer;
begin
sourceDirty := TDirty.Construct;
sourceDirty := TFlag.CreateFlag;
sourceDirty.Reset;
procCallCount := 0;
funcLazy :=
@@ -335,10 +335,10 @@ var
funcLazy: IMycLazy<Integer>;
value: Integer;
resultPop1, resultPop2: Boolean;
sourceDirty: IMycDirty;
sourceDirty: IMycFlag;
procCallCount: Integer;
begin
sourceDirty := TDirty.Construct;
sourceDirty := TFlag.CreateFlag;
sourceDirty.Reset;
procCallCount := 0;
funcLazy :=
@@ -367,11 +367,11 @@ var
funcLazy: IMycLazy<Integer>;
value: Integer;
result: Boolean;
sourceDirty: IMycDirty;
sourceDirty: IMycFlag;
procCallCount: Integer;
initialValue, firstSourceChangeValue: Integer;
begin
sourceDirty := TDirty.Construct;
sourceDirty := TFlag.CreateFlag;
sourceDirty.Reset; // sourceDirty.IsSet is FALSE
procCallCount := 0;
initialValue := 51;
@@ -427,10 +427,10 @@ end;
procedure TTestMycCoreLazy.TestFuncLazy_Destroy_UnsubscribesFromSource;
var
funcLazyObj: TMycFuncLazy<Integer>;
sourceDirty: IMycDirty;
sourceDirty: IMycFlag;
tempVal: Integer;
begin
sourceDirty := TDirty.Construct;
sourceDirty := TFlag.CreateFlag;
sourceDirty.Reset;
funcLazyObj := TMycFuncLazy<Integer>.Create(sourceDirty.State, function: Integer begin Result := 1; end);
Assert.IsTrue(funcLazyObj.Pop(tempVal), 'Initial Pop should succeed');
@@ -448,11 +448,11 @@ var
funcLazy: IMycLazy<Integer>;
value: Integer;
result: Boolean;
sourceDirty: IMycDirty;
sourceDirty: IMycFlag;
expectedValue: Integer;
procExecuted: Boolean;
begin
sourceDirty := TDirty.Construct;
sourceDirty := TFlag.CreateFlag;
Assert.IsTrue(sourceDirty.State.IsSet, 'SourceDirty should be initially set for this test scenario');
expectedValue := 70;
procExecuted := False;