I know the first part of this question has been asked before, but that was a long time ago :). I was wondering if the mean time any of the open source mocking frameworks caught up with Typemock Isolator++ when it comes to mocking non-virtual methods and C functions. I'm mostly interested in gcc under Linux. So far, I'm interested in mocking accessors (so that I can simulate states in the mocked object - see below) and replacing C functions from other libraries (select, pcap_*, etc.).
class Foo {
public:
...
bool IsCondition() { return condition; };
...
private:
bool condition;
}
// I want a framework that allows me to do something like this:
TEST(TestFoo) {
MOCK_INTERFACE(Foo) mock_foo;
EXPECT_CALL(mock_foo, IsCondition).returns(true);
EXPECT(mock_foo.IsCondition());
}