c++ - Are multiple coexistent instances of MockRepository possible? If yes under which conditions? -


Hippomox supports' mock replica as many examples, as far as the compiler is concerned . Some usage cases are not possible, however, because they move towards unit test executable accidents. Let's consider the following example.

  minus myacl () {} void MyCall2 () {} void MySubTest () {MockRepository mockRep2; MockRep2.ExpectCallFunc (MyCall2); MyCall2 (); } Zero MyTest () {Mock Raptory Mockery 1; MockRep1.ExpectCallFunc (MyCall); MySubTest (); my call(); }   

This example (Visual C ++ 2010) happens to read an unused exception (Access violation space 0x00000048).

  • An analysis of the Hippomox header reveals that it does not appear to be a matter of use (cf. MockRepoInstanceHolder ). What is the reason behind allowing only one instance?
  • I can understand that for example in ExpectCallFunc the MockRepository can oppose the examples. What is the reason behind this?
  • We can solve this problem by moving our example after calling mockRep1 immediately MySubTest () , but in the first place We had a hard time understanding the problem, is there a compiled time or run-time possibility to clearly identify many such examples? The problem of root is that the function (compile time generated) functions a specific counterfeit stock. There is no place to 'tag' with and instead of counterfeit goods, it can not be grown to carry it too. This is for the holder to find duplicate stores from generated stub function.

    It seems like a solvable problem if a good use case for it, by making the code generated in that function a bit more complicated. I have to admit that I do not see a direct instantaneous benefit, especially if two different repo jokes twice in the same ceremony, will not work anyway (because you work hard with one function Are writing) and it would be very difficult to debug problems if you combine them at some point I do not think added complexity and debugging difficulties were added by this The weight is above the mode.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -