New Test-Startegy

This commit is contained in:
Michael Schimmel
2025-07-22 17:21:59 +02:00
parent c530f2fc0b
commit e6d41260f9
6 changed files with 311 additions and 42 deletions
+48
View File
@@ -89,6 +89,15 @@ type
constructor Create(const AFunc: TConstFunc<S, T>);
end;
TMycGenericAggregator<S, T> = class(TMycConverter<S, T>)
private
FFunc: TConstFunc<S, TConverter<S, T>.TBroadcastProc, TState>;
protected
function ProcessData(const Value: S): TState; override;
public
constructor Create(const AFunc: TConstFunc<S, TConverter<S, T>.TBroadcastProc, TState>);
end;
TMycGenericParallelConverter<S, T> = class(TMycConverter<S, T>)
private
FFunc: TConstFunc<S, T>;
@@ -235,6 +244,17 @@ type
property Sender: TMycContainedDataProvider<TArray<T>> read FSender implements TDataProvider<TArray<T>>.IDataProvider;
end;
TMycComposedConverter<S, T> = class(TMycProcessor<S>, TConverter<S, T>.IConverter)
private
FProcessor: IMycProcessor<S>;
FDataProvider: TDataProvider<T>;
protected
function ProcessData(const Value: S): TState; override;
function GetSender: TDataProvider<T>.IDataProvider;
public
constructor Create(const AProcessor: IMycProcessor<S>; const ADataProvider: TDataProvider<T>);
end;
implementation
uses
@@ -892,4 +912,32 @@ begin
FSender.Broadcast(Arr);
end;
constructor TMycGenericAggregator<S, T>.Create(const AFunc: TConstFunc<S, TConverter<S, T>.TBroadcastProc, TState>);
begin
inherited Create;
FFunc := AFunc;
end;
function TMycGenericAggregator<S, T>.ProcessData(const Value: S): TState;
begin
Result := FFunc(Value, function(const Value: T): TState begin Result := FSender.Broadcast(Value); end);
end;
constructor TMycComposedConverter<S, T>.Create(const AProcessor: IMycProcessor<S>; const ADataProvider: TDataProvider<T>);
begin
inherited Create;
FProcessor := AProcessor;
FDataProvider := ADataProvider;
end;
function TMycComposedConverter<S, T>.GetSender: TDataProvider<T>.IDataProvider;
begin
Result := FDataProvider;
end;
function TMycComposedConverter<S, T>.ProcessData(const Value: S): TState;
begin
Result := FProcessor.ProcessData(Value);
end;
end.