2、test result
[ RUN ] ft_test.demo
/home/tangshp/Code_ws/googleTest_mockcpp/test/ft_test.cpp:13: Failure
Expected equality of these values:
300
add(1, 4)
Which is: 5
[ FAILED ] ft_test.demo (0 ms)
[----------] 1 test from ft_test (0 ms total)
3、googletest+mockcpp
mockcpp-build-step:
➜ build xunit_home=/usr/local
➜ build cmake -DMOCKCPP_XUNIT=gtest -DMOCKCPP_XUNIT_HOME=$xunit_home -DCMAKE_INSTALL_PREFIX=/usr/local ..
➜ build sudo make && make install
1、code static int add(int left, int right) { return left + right; }
TEST(ft_test, demo) { GlobalMockObject::reset(); MOCKER(add).stubs().with(any()).will(returnValue(300)); EXPECT_EQ(300, add(1, 4)); }
2、test result [ RUN ] ft_test.demo /home/tangshp/Code_ws/googleTest_mockcpp/test/ft_test.cpp:13: Failure Expected equality of these values: 300 add(1, 4) Which is: 5 [ FAILED ] ft_test.demo (0 ms) [----------] 1 test from ft_test (0 ms total)
3、googletest+mockcpp mockcpp-build-step: ➜ build xunit_home=/usr/local ➜ build cmake -DMOCKCPP_XUNIT=gtest -DMOCKCPP_XUNIT_HOME=$xunit_home -DCMAKE_INSTALL_PREFIX=/usr/local .. ➜ build sudo make && make install