Hi,
it seems I hit a bug in mockpp. :-(
The problem is that if I use an OutBound constraint in a
VisitableMockObject, then I cannot use verify() on the object. The
attached test program (vm.cpp) will fail, complaining that the return list
of the OutBound object is empty:
mendel@vger:~$ ./vm
terminate called after throwing an instance of
'mockpp::AssertionFailedError'
what(): foo/parameter1 added constraint[0] does not match: <returns
[]> != 0
Aborted (core dumped)
I tried to investigate the problem, and I found that
ConstraintList::checkImmediateValue() is called _two_ times on each
constraint. The first call is performed in addActual() - unless constraint
checking is deferred until verify() call - and the second call in
verify(). It seems to me as erroneous, since the first call pops the
outbound value from the list, so the second call will surely fail.
(This does not matter for the 'normal' constraints - they can be
eval()'d many times -, that's why it went unnoticed till now.)
I created a patch (attached as mockpp-1.16.4-OutBound_verify_fix.diff)
that worked for me, but unfortunately I was not able to compile the unit
tests (and so I was unable to check if it does not break something else).
Can you please check if my reasoning is right, and check if the patch is
correct?
Best regards,
norbi |