Skip to content

Commit

Permalink
Added changes using gmock
Browse files Browse the repository at this point in the history
  • Loading branch information
richiprosima committed May 19, 2016
1 parent 207b0ed commit 583d0a8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
12 changes: 12 additions & 0 deletions cmake/dev/gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ macro(check_gtest)
endif()
endif()
find_package(GTest)

if(GTEST_FOUND)
find_package(Threads REQUIRED)
set(GTEST_LIBRARIES ${GTEST_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
set(GTEST_BOTH_LIBRARIES ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
endif()
endif()
endmacro()

Expand All @@ -45,6 +51,12 @@ macro(check_gmock)
endif()
endif()
find_package(GMock)

if(GMOCK_FOUND)
find_package(Threads REQUIRED)
set(GMOCK_LIBRARIES ${GMOCK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
set(GMOCK_BOTH_LIBRARIES ${GMOCK_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
endif()
endif()
endmacro()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _RTPS_READER_STATEFULREADER_H_

#include <fastrtps/rtps/attributes/ReaderAttributes.h>
#include <fastrtps/rtps/common/Guid.h>

namespace eprosima
{
Expand All @@ -13,6 +14,9 @@ namespace eprosima
{
public:

// In real class, inherited from Endpoint base class.
inline const GUID_t& getGuid() const { return GUID_t(); };

inline ReaderTimes& getTimes(){return m_times;};

private:
Expand Down
3 changes: 2 additions & 1 deletion test/unittest/rtps/reader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if(NOT ((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER))

set(WRITERPROXYTESTS_SOURCE WriterProxyTests.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/reader/WriterProxy.cpp
${PROJECT_SOURCE_DIR}/src/cpp/log/Log.cpp
)

if(WIN32)
Expand All @@ -24,7 +25,7 @@ if(NOT ((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER))
${PROJECT_SOURCE_DIR}/test/mock/rtps/WriterProxyLiveliness
${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include/${PROJECT_NAME})
target_link_libraries(WriterProxyTests ${Boost_LIBRARIES}
${GTEST_LIBRARIES} ${GMOCK_LIBRARIES}
${GMOCK_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT})
endif()
endif()
4 changes: 2 additions & 2 deletions test/unittest/rtps/reader/WriterProxyTests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <gtest/gtest-death-test.h>

#define TEST_FRIENDS \
FRIEND_TEST(WriterProxyTests, MissingChangesUpdate); \
Expand Down Expand Up @@ -315,6 +315,6 @@ namespace eprosima

int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
testing::InitGoogleMock(&argc, argv);
return RUN_ALL_TESTS();
}

0 comments on commit 583d0a8

Please sign in to comment.