Skip to content

Commit

Permalink
GTest has been integrated w/o it's sources in source tree
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya V. Storozhilov authored and Ilya V. Storozhilov committed Nov 20, 2014
1 parent 37ca760 commit 7802ab0
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
add_subdirectory (functional)
add_subdirectory (unit)
13 changes: 13 additions & 0 deletions tests/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if ("${GMOCK_SOURCE_DIR}" STREQUAL "")
message ("GMOCK_SOURCE_DIR variable not set - unit-tests are not available. Use '-DGMOCK_SOURCE_DIR=<path_to_gmock_sources>' param for CMake")
else ()
set (gmock_force_shared_crt true CACHE INTERNAL "")
set (BUILD_SHARED_LIBS false CACHE INTERNAL "")
add_subdirectory (${GMOCK_SOURCE_DIR} ${CMAKE_BINARY_DIR}/gmock)
set (GMOCK_LIBRARIES gmock)
set (GMOCK_INCLUDE_DIRS "${GMOCK_SOURCE_DIR}/include"
"${GMOCK_SOURCE_DIR}/gtest/include")
include_directories (${CMAKE_SOURCE_DIR}/src ${GMOCK_INCLUDE_DIRS} ${GMOCK_SOURCE_DIR})

add_subdirectory (utils)
endif ()
5 changes: 5 additions & 0 deletions tests/unit/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set(UTILS_TEST_EXECUTABLE test_utils)
aux_source_directory("." SRC_TEST_LIST)
add_executable(${UTILS_TEST_EXECUTABLE} ${SRC_TEST_LIST})
target_link_libraries(${UTILS_TEST_EXECUTABLE} ${GMOCK_LIBRARIES})
add_test(test_utils ${UTILS_TEST_EXECUTABLE})
8 changes: 8 additions & 0 deletions tests/unit/utils/filtered_data.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include <utils/filtered_data.h>

TEST(FilteredData, construct)
{
EXPECT_NO_THROW(NST::utils::FilteredData());
}
9 changes: 9 additions & 0 deletions tests/unit/utils/test_utils.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>

int main(int argc, char **argv)
{
setenv("LANG", "C", 1);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

0 comments on commit 7802ab0

Please sign in to comment.