[amop-group] call() assertions don't always fire if the function is not called.

10 views
Skip to first unread message

Erik Fears

unread,
May 13, 2010, 7:00:24 PM5/13/10
to amop-...@googlegroups.com
I've included the failing interface and test (cgreen based) below. I've removed all functions from the interface except for the destructor and the method in question. AsyncCallback is a function pointer typedef.

Why doesn't this throw? Usually if I setup a call expectation and I do not call the function, amop will throw. I tried adding a mockStream.verify() at the end of the test method, but that did not help.

I am running the latest from svn.

Thanks
Erik


class Stream
{
public:
    virtual ~Stream();
    ...
    virtual void beginRead(AsyncCallback callback, void* state) = 0;
    ...   
};


//This test should throw, but it does not.
Ensure xxx()
{
    MockObject<Stream> mockStream;
    mockStream.call(&Stream::beginRead);
    //mockStream->beginRead(NULL,NULL);
}

--
You received this message because you are subscribed to the Google Groups "amop group" group.
To post to this group, send email to amop-...@googlegroups.com.
To unsubscribe from this group, send email to amop-group+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/amop-group?hl=en.

Erik Fears

unread,
May 14, 2010, 12:52:07 PM5/14/10
to amop-...@googlegroups.com
This seems to fail in much simpler circumstances. The simple expectation below of a single function call with no parameters, returning void, does not cause an amop exception.

class Foo
{
public:
    virtual void beginRead(int f) = 0;
};


Ensure xxx()
{
        MockObject<Foo> mockStream;
        mockStream.call(&Foo::beginRead);

Erik Fears

unread,
May 14, 2010, 1:23:49 PM5/14/10
to amop-...@googlegroups.com
Nevermind, this seems to work:

class Foo
{
public:
    virtual void beginRead() = 0;

};


Ensure xxx()
{
        MockObject<Foo> mockStream;
        mockStream.everyCall(&Foo::beginRead).count(1);
Reply all
Reply to author
Forward
0 new messages