Implemented TLazy + Tests
This commit is contained in:
+8
-8
@@ -91,7 +91,7 @@ var
|
||||
jobCompletedLatch: IMycLatch;
|
||||
begin
|
||||
jobExecuted := False;
|
||||
jobCompletedLatch := TMycLatch.CreateLatch(1); // Changed from Signals.CreateLatch
|
||||
jobCompletedLatch := TLatch.Construct(1); // Changed from Signals.CreateLatch
|
||||
|
||||
FFactory.Run(
|
||||
procedure
|
||||
@@ -111,7 +111,7 @@ var
|
||||
subscriber: IMycSubscriber;
|
||||
begin
|
||||
jobExecuted := False;
|
||||
jobCompletedLatch := TMycLatch.CreateLatch(1); // Changed from Signals.CreateLatch
|
||||
jobCompletedLatch := TLatch.Construct(1); // Changed from Signals.CreateLatch
|
||||
|
||||
subscriber := FFactory.Run(
|
||||
procedure
|
||||
@@ -122,7 +122,7 @@ begin
|
||||
|
||||
Assert.IsNotNull(subscriber, 'Run should return a subscriber for delayed job');
|
||||
// Use TMycLatch.Null for comparison
|
||||
Assert.AreNotEqual<IMycSubscriber>(TMycLatch.Null, subscriber, 'Subscriber should not be TMycLatch.Null for StartCount > 0');
|
||||
Assert.AreNotEqual<IMycSubscriber>(TLatch.Null, subscriber, 'Subscriber should not be TMycLatch.Null for StartCount > 0');
|
||||
|
||||
subscriber.Notify;
|
||||
|
||||
@@ -137,7 +137,7 @@ var
|
||||
startTime, endTime: Cardinal;
|
||||
begin
|
||||
// TMycLatch.CreateLatch(0) will return TMycLatch.Null
|
||||
alreadySetLatch := TMycLatch.CreateLatch(0); // Changed from Signals.CreateLatch
|
||||
alreadySetLatch := TLatch.Construct(0); // Changed from Signals.CreateLatch
|
||||
Assert.IsTrue(alreadySetLatch.State.IsSet, 'Latch should be initially set');
|
||||
|
||||
startTime := TThread.GetTickCount;
|
||||
@@ -155,7 +155,7 @@ var
|
||||
begin
|
||||
inMainThreadInJob := True;
|
||||
inWorkerThreadInJob := False;
|
||||
jobDoneLatch := TMycLatch.CreateLatch(1); // Changed from Signals.CreateLatch
|
||||
jobDoneLatch := TLatch.Construct(1); // Changed from Signals.CreateLatch
|
||||
|
||||
Assert.IsTrue(FFactory.InMainThread, 'Test method itself should be in main thread');
|
||||
Assert.IsFalse(FFactory.InWorkerThread, 'Test method itself should not be in a factory worker thread');
|
||||
@@ -178,7 +178,7 @@ procedure TMycTaskFactoryTests.TestExceptionPropagationFromJob;
|
||||
var
|
||||
jobDoneLatch: IMycLatch;
|
||||
begin
|
||||
jobDoneLatch := TMycLatch.CreateLatch(1);
|
||||
jobDoneLatch := TLatch.Construct(1);
|
||||
|
||||
FFactory.EnqueueJob(
|
||||
procedure
|
||||
@@ -229,8 +229,8 @@ var
|
||||
dummyStateToWaitFor: IMycState;
|
||||
begin
|
||||
exceptionCaughtInJob := False;
|
||||
jobDoneLatch := TMycLatch.CreateLatch(1);
|
||||
dummyStateToWaitFor := TMycLatch.CreateLatch(1).State;
|
||||
jobDoneLatch := TLatch.Construct(1);
|
||||
dummyStateToWaitFor := TLatch.Construct(1).State;
|
||||
|
||||
FFactory.EnqueueJob(
|
||||
procedure
|
||||
|
||||
Reference in New Issue
Block a user