Skip to content

Integer compare always true #333

@monkeysfoot

Description

@monkeysfoot

I have a test defined like so:

[Test]
 [TestCase('TestSetAsInteger 001.', '0')]
 [TestCase('TestSetAsInteger 002.', '666')]
 procedure TestSetAsInteger(IntVal : integer);

And Implemented like so:

procedure TTestKeyValueList.TestSetAsInteger(IntVal: integer);
begin
  FKVL.AsInteger['testkey'] := IntVal;
  Assert.AreEqual(IntVal, FKVL.AsInteger['testkey']);
end;

The methods in FKVL are stubs, so they should fail. Problem is, they always pass.

Now, If I change the test implementation to:

procedure TTestKeyValueList.TestSetAsInteger(IntVal: integer);
begin
  FKVL.AsInteger['testkey'] := IntVal;
  Sleep(1);  //This can be anything really, I can call FKVL.Count or other some such
  Assert.AreEqual(IntVal, FKVL.AsInteger['testkey']);
end;

The test now works as intended. Weird.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions