Hi,

AssertEquals always gives an Access violation error for some reason.
First some background info is needed....

I first write some of my tests using AssertTrue as follows:
 AssertTrue('Failed on 2', posClean = lNode1.ObjectState);

This just raise the exception when they didn't match. I preferred to
have the style expected <> but got <> message.  So I started change
those tests to the following:

 AssertEquals('Failed on 5', ObjectStateToString(posClean),
   ObjectStateToString(lList.ObjectState));

This worked fine, but after doing this for a while I realized I am
typing my life away with all those ObjectStateToString() calls.  Then
I thought, why don't I create a new AssertEquals method for my
projects that take TPerObjectState as parameters.  So I created this
in my custom test case class.

{ defined under Public }
procedure TM2TestCase.AssertEquals(const pMessage: string; pExpected,
 pActual: TPerObjectState);
begin
 AssertEquals(pMessage,
   ObjectStateToString(pExpected),
   ObjectStateToString(pActual));
end;

BTW: TPerObjectState is define as follows...

 TPerObjectState = (
                     posEmpty,
                     posPK,
                     posCreate,
                     posUpdate,
                     posDelete,
                     posDeleted,
                     posClean
                    ) ;



Now changing my test to the following, which is much easier to type and read:

 AssertEquals('Failed on 1', posEmpty, lLang.ObjectState);


Finally, getting back to the problem.  Using this new AssertEquals
always gives me a Access violation error.  I know there is a
AssertEquals that uses TClass, could that interfere with this?  I even
tried changing my new AssertEquals to use a different name
AssertEqualsObjState(), but that didn't help either.

What could be causing the problem?

Regards,
 - Graeme -


--
There's no place like 127.0.0.1
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to