-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Description
When using more than one mock repository, the destructor of the second mock repository fails with a memory access violation at hippomocks.h:942 when calling TestFinished() on the reporter of the second repository as MockRepoInstanceHolder<0>::instance = nullptr; and MockRepoInstanceHolder<0>::reporter = nullptr; has been called in the destructor of the first mock repository.
Sample code:
#include <boost/test/unit_test.hpp>
#include <hippomocks.h>
struct Foo
{
virtual ~Foo() noexcept = 0;
virtual int foo() = 0;
};
struct Bar
{
virtual ~Bar() noexcept = 0;
virtual int bar() = 0;
};
struct Fixture
{
Fixture()
{
mocks_foo.autoExpect = false;
mocks_bar.autoExpect = false;
foo.reset(mocks_foo.Mock<Foo>());
bar.reset(mocks_bar.Mock<Bar>());
mocks_foo.ExpectCallDestructor(foo.get());
mocks_bar.ExpectCallDestructor(bar.get());
}
HippoMocks::MockRepository mocks_foo;
HippoMocks::MockRepository mocks_bar;
std::shared_ptr<Foo> foo;
std::shared_ptr<Bar> bar;
};
BOOST_FIXTURE_TEST_SUITE(HippoMocksTest, Fixture)
BOOST_AUTO_TEST_CASE(hippomocks_two_repos)
{
}
BOOST_AUTO_TEST_SUITE_END()
Metadata
Metadata
Assignees
Labels
No labels