Code formatting
This commit is contained in:
@@ -18,7 +18,7 @@ type
|
||||
PTestSListEntryData = ^TTestSListEntryData;
|
||||
TTestSListEntryData = record
|
||||
Entry: TSListEntry; // The SList entry structure
|
||||
ID: Integer; // Sample data associated with the entry
|
||||
ID: Integer; // Sample data associated with the entry
|
||||
end;
|
||||
|
||||
[TestFixture]
|
||||
@@ -109,7 +109,8 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
uses System.TypInfo;
|
||||
uses
|
||||
System.TypInfo;
|
||||
|
||||
{ TTestSList }
|
||||
|
||||
@@ -147,14 +148,14 @@ begin
|
||||
// Popping to empty the list if not already empty
|
||||
end;
|
||||
tempList := FList; // Store to call Free
|
||||
FList := nil; // Prevent using FList after Free
|
||||
tempList.Free; // Free the TSList structure itself
|
||||
FList := nil; // Prevent using FList after Free
|
||||
tempList.Free; // Free the TSList structure itself
|
||||
end;
|
||||
|
||||
// Free all allocated PTestSListEntryData
|
||||
for entryNode in FEntries do
|
||||
begin
|
||||
var P:= entryNode;
|
||||
var P := entryNode;
|
||||
FreeMemAligned(P);
|
||||
end;
|
||||
SetLength(FEntries, 0);
|
||||
@@ -277,10 +278,11 @@ begin
|
||||
// This test confirms that using an aligned entry from AllocEntryData works.
|
||||
entryData := AllocEntryData(123);
|
||||
// This should not raise an assertion error from TSList.Push.
|
||||
Assert.WillNotRaise(procedure
|
||||
begin
|
||||
FList.Push(@entryData.Entry);
|
||||
end, nil, 'Pushing an aligned entry should not raise an exception/assertion.');
|
||||
Assert.WillNotRaise(
|
||||
procedure begin FList.Push(@entryData.Entry); end,
|
||||
nil,
|
||||
'Pushing an aligned entry should not raise an exception/assertion.'
|
||||
);
|
||||
Assert.AreEqual(1, FList.QueryDepth, 'QueryDepth should be 1 after pushing an aligned entry.');
|
||||
end;
|
||||
|
||||
@@ -391,10 +393,7 @@ end;
|
||||
procedure TTestMycAtomicStack_Integer.TestClear_OnEmptyStack;
|
||||
begin
|
||||
// Clearing an already empty stack should not cause issues
|
||||
Assert.WillNotRaise(procedure
|
||||
begin
|
||||
FStack.Clear;
|
||||
end, nil, 'Clear on an empty stack should not raise an exception.');
|
||||
Assert.WillNotRaise(procedure begin FStack.Clear; end, nil, 'Clear on an empty stack should not raise an exception.');
|
||||
Assert.AreEqual(Default(Integer), FStack.Pop, 'Stack should remain empty after Clear on empty stack.');
|
||||
end;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user