锘??xml version="1.0" encoding="utf-8" standalone="yes"?>中文字幕乱码人妻无码久久,狠狠色丁香久久婷婷综合_中,国产精品亚洲美女久久久http://www.shnenglu.com/xyjzsh/category/20378.htmlzh-cnWed, 06 Feb 2013 09:45:09 GMTWed, 06 Feb 2013 09:45:09 GMT60first demo for gtesthttp://www.shnenglu.com/xyjzsh/archive/2013/02/06/197758.html 鍛嗕漢 鍛嗕漢Wed, 06 Feb 2013 09:14:00 GMThttp://www.shnenglu.com/xyjzsh/archive/2013/02/06/197758.htmlhttp://www.shnenglu.com/xyjzsh/comments/197758.htmlhttp://www.shnenglu.com/xyjzsh/archive/2013/02/06/197758.html#Feedback0http://www.shnenglu.com/xyjzsh/comments/commentRss/197758.htmlhttp://www.shnenglu.com/xyjzsh/services/trackbacks/197758.html1. 棣栧厛緇欏嚭絎竴涓繍鐢╣test鐨刣emo
#include "stdafx.h" #include "gmock/gmock-actions.h" usingnamespace testing; class Calculate { public: Calculate(){} long add(long a,long b){return a+b;} }; class CalculateMock:public Calculate { public: CalculateMock():Calculate(){} MOCK_METHOD2(add,long(long a,long b)); }; long testFun(Calculate& cal) { return cal.add(2,3); } TEST(testMock,testAdd) { CalculateMock obj; long len =10; ON_CALL(obj,add(2,3)).WillByDefault(Return(len)); EXPECT_CALL(obj,add(2,3)).Times(1); //obj.add(2,3); EXPECT_EQ(10, obj.add(2,3)); } int _tmain(int argc, _TCHAR* argv[]) { testing::InitGoogleMock(&argc, argv); RUN_ALL_TESTS(); return0; }
鍋氱涓涓猟emo闇瑕佹敞鎰忕殑浜嬮」錛?br />1. 灝嗙敤鍒扮殑gtest,gmock,鍜屼綘鑷繁榪愮敤鐨刾roject鐢ㄥ悓鏍風(fēng)殑code generation 鐨勫艦寮忎竴鑷?灝?project property->C++->Code Generation: 璁劇疆涓猴細(xì)Multi-threaded Debug(/MTd) 2. 娣誨姞 using namespace testing, 鍚﹀垯浼?xì)鍑虹?#8216;Return’Identifier not found.榪欐牱鐨勯敊璇?br /> So excited to make it work after so much confusion, anxiety. Fighting!!