Re: Trouble With Expect call

1,940 views
Skip to first unread message

dontmockme

unread,
Jul 11, 2012, 9:51:16 AM7/11/12
to googl...@googlegroups.com
problem might be calling method and expecting method both are same
see the following example.
Code snippet:
class Test
{
public:
Test(){}
virtual ~Test(){}
       void ParenttestFn()
       {
          TestFn();
       }
virtual void TestFn() 
{
}
};

class TestMock : public Test
{
public:
MOCK_METHOD0(TestFn, void());
};

TEST(SampleTest,SampleTestCase)
{
TestMock mockObj;
EXPECT_CALL(mockObj, TestFn());
mockObj. ParenttestFn ();
}.

your expectations should be something like above

On Wednesday, July 11, 2012 5:38:46 PM UTC+5:30, ravikiran wrote:
Hi,

I'm having trouble with the EXPECT_CALL.It's give an SEH exception and i have no clue why this error is generated.

Code snippet:
class Test
{
public:
Test(){}
virtual ~Test(){}
virtual void TestFn() 
{
}
};

class TestMock : public Test
{
public:
MOCK_METHOD0(TestFn, void());
};

TEST(SampleTest,SampleTestCase)
{
TestMock mockObj;
EXPECT_CALL(mockObj, TestFn());
mockObj.TestFn();
}


This is the error it gives in the cmd:
unknown file : error : SEH exception with code 0xc0000005 thrown in the test body.
Please help.
Thanks!!!

Greg Miller

unread,
Jul 11, 2012, 10:07:37 AM7/11/12
to ravikiran, googl...@googlegroups.com
I don't see anything wrong with the sample code you posted. I googled [gmock SEH exception with code 0xc0000005] and most answers seem to indicate compiler flag issue.

Keith Ray

unread,
Jul 11, 2012, 12:11:41 PM7/11/12
to Google C++ Mocking Framework
Namespace issue?

Could your class to be mocked be inheriting from ::testing::Test and not your ::Test class?

Any compiler warnings?

--
C. Keith Ray
twitter: @ckeithray
phone: 650-KEY-4RAY
       650-539-4729



Reply all
Reply to author
Forward
0 new messages