This introduces a unified interface to the mocks in test_unite_mocks.h. So far the mocks were growing uncontrolled and some were more like fakes, stubs, and whatever you want to call these things. Most important however: Some of them were different in spirit from other ones.
Now every Mock (every class ending in *Mock) has a member field for every overloaded function called mock_NameOfThatFunction. That function can be stubbed (using SetStub), the result to be returned can be set (using SetResult), the invocations of a particular method can be checked (CountInnovations) and the number of times a Mock was interacted with (CountInteractions).
In order to streamline the mocks I needed to touch a few tests, most heavily I touched state_db_tests. In order to wrap my head around it I created a blocktool that allows to clearly create chains of block indexes. It is itself unit tested.
This introduces a unified interface to the mocks in
test_unite_mocks.h
. So far the mocks were growing uncontrolled and some were more like fakes, stubs, and whatever you want to call these things. Most important however: Some of them were different in spirit from other ones.Now every Mock (every class ending in
*Mock
) has a member field for every overloaded function calledmock_NameOfThatFunction
. That function can be stubbed (usingSetStub
), the result to be returned can be set (usingSetResult
), the invocations of a particular method can be checked (CountInnovations
) and the number of times a Mock was interacted with (CountInteractions
).In order to streamline the mocks I needed to touch a few tests, most heavily I touched
state_db_tests
. In order to wrap my head around it I created a blocktool that allows to clearly create chains of block indexes. It is itself unit tested.Signed-off-by: Julian Fleischer julian@thirdhash.com