c++ - GoogleMock - Matchers and MFC\ATL CString -


I asked this question on Google Groups but I think I will get a quick response here.

I am trying to use to test my code. I am also using them. I am compiling in VC9. I am having problems matching the MFC \ ATL seetering arguments I Gecko says that the objects are not equal and it seems that this indicator is evaluating the addresses. The method I am attempting to fake is structured like this:

  zero myMethod (const CString & key, const csrtring & value);  

type:

  MOCK_METHOD2 (myMethod, void (const CSTIring and key, const. And value);  
< P> While setting my expectations I am doing the following comparison:

  CSTING szKey = _T ("some key"); CString szValue = _T ("some value"); EXPECT_CALL (myMock, Mary Mathew (IKK), one (SGLUE). Will One (Returns);  

I have tried several different combinations such as :

  EXPECT_CALL (Mimeo , Microt (Stracseek (_T ("some key"), strxike (_T ("some value)). Will one (return true); EXPECT_CALL (Mymock, MyMthi (typed AEC & lt; constant septing & amp; ; ;;;;;;;;;;;;;;;;;;;;44;; (sqkei), type f. lieutenant; konst cstir & gt; (sj value). Will one (return (true)); EXPECT_CALL (Mymock, Mymouth (typedA & lt; constant cstiting & amp; ; ;;;;;;;;;;;;;;;;;;;;;); (SJK), type ap, lieutenant; kest cesting & gt; (sj valley). Single forest (return (true));  

Any call mentioned above has produced the same result. This issue?

This is untamed:

Google Mock tried the following 2 expectations, but none matched:

 : 80: trial Expected # 0 Expected ARB # 1: "Some Value" Equals to 006D430C Actual: 4-Byte Object & lt; A8EF 1102 & gt; Expected: Once said: Never asked - Dissatisfied and active: 83: Expected test # 1 Expected arg # 1: (Unseen case) is equal to "" Actual: 4-byte object " A8EF 1102 & gt; Expected arg # 2: (unseen case) is equal to "some values" Actual: 4-byte object  

Adam

When you pass your method, then you are not making a copy of the string, do you really need to check their values? The following expectations should be sufficient to write:

  CSTING szKey = _T ("some key"); CString szValue = _T ("some value"); EXPECT_CALL (MyMoac, MyMipe (SJK, SGA Value)). Will One (return (true));  

... which will check that the given string to the duplicate method is actually those that you can expect (validated by address), and not per or other string.

do not work with coding, so I doubt that CString does not override operator () == or Mike's There is no clear expertise for implementation in CString .


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -