Search Results

Search found 3 results on 1 pages for 'gmock'.

Page 1/1 | 1 

  • Gmock setting out parameter

    - by user1135541
    Have a gmock method, and during test, need to set the out parameter to variable address. So that the out parameter of dequeue, which is data points to variable ch; MOCK_METHOD1(dequeue, void(void* data)); char ch = 'm'; void* a = (void*)&ch; EXPECT_CALL(FQO, dequeue(_)) .WillOnce(/*here I need to set argument to a*/); I tried to figure out side effects: https://code.google.com/p/googlemock/wiki/V1_7_CheatSheet#Side_Effects but keep getting an error.

    Read the article

  • Howto install google-mock on Ubuntu 12.10

    - by user1459339
    I am having hard time trying to install Google C++ Mocking Framework. I have successfully run sudo apt-get install google-mock. Then I tried to compile this sample file #include "gmock/gmock.h" int main(int argc, char** argv) { ::testing::InitGoogleMock(&argc, argv); return RUN_ALL_TESTS(); } with g++ -lgmock main.cpp and these errors have shown main.cpp:(.text+0x1e): undefined reference to `testing::InitGoogleMock(int*, char**)' main.cpp:(.text+0x23): undefined reference to `testing::UnitTest::GetInstance()' main.cpp:(.text+0x2b): undefined reference to `testing::UnitTest::Run()' collect2: error: ld returned 1 exit status I guess the linker can not find the library files. Does anybody know how to fix this?

    Read the article

  • Howto mix TDD and RAII

    - by f4
    I'm trying to make extensive tests for my new project but I have a problem. Basically I want to test MyClass. MyClass makes use of several other class which I don't need/want to do their job for the purpose of the test. So I created mocks (I use gtest and gmock for testing) But MyClass instantiate everything it needs in it's constructor and release it in the destructor. That's RAII I think. So I thought, I should create some kind of factory, which creates everything and gives it to MyClass's constructor. That factory could have it's fake for testing purposes. But's thats no longer RAII right? Then what's the good solution here?

    Read the article

1