-
-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jason Gauci
committed
Feb 28, 2018
1 parent
76948ba
commit 3f6c93f
Showing
9 changed files
with
65 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# Code Coverage | ||
code-coverage.info | ||
code_coverage_report | ||
|
||
# OS/X Junk file | ||
.DS_Store | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule "cmake/external/googletest"] | ||
path = cmake/external/googletest | ||
[submodule "googletest"] | ||
path = external/googletest | ||
url = https://github.com/google/googletest.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule googletest
deleted from
a2b8a8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
pushd ./build | ||
cmake ../ -DBUILD_TEST=ON -DBUILD_GTEST=ON | ||
make -j8 | ||
popd | ||
./build/test/EternalTCP-test | ||
lcov --directory ./build --capture --output-file ./code-coverage.info -rc lcov_branch_coverage=1 | ||
genhtml code-coverage.info --branch-coverage --output-directory ./code_coverage_report/ | ||
echo "Report generated in code_coverage_report" | ||
open code_coverage_report/index.html |
Submodule googletest
added at
ec44c6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,37 @@ | ||
|
||
# set the path for all test files | ||
set(GTEST_PATH ${PROJECT_SOURCE_DIR}/test) | ||
# | ||
# Add your unit tests here | ||
# | ||
set(GTEST_SRC | ||
test_template.cpp | ||
) | ||
# Add test executable target | ||
set(TESTPREFIX gtest_) | ||
foreach(SRC_LINE ${GTEST_SRC}) | ||
string(REPLACE ".cpp" "" FILE_LINE ${SRC_LINE}) | ||
|
||
add_executable(${FILE_LINE} ${SRC_LINE}) | ||
add_dependencies(${FILE_LINE} ${PROJECT_NAME}-static gtest gtest_main gmock gmock_main) | ||
file(GLOB TEST_SRCS Test*.cpp ) | ||
add_executable( | ||
${PROJECT_NAME}-test | ||
|
||
${TEST_SRCS} | ||
) | ||
|
||
add_dependencies( | ||
${PROJECT_NAME}-test | ||
TerminalCommon | ||
${PROJECT_NAME}-static | ||
gtest | ||
gtest_main | ||
gmock | ||
gmock_main) | ||
|
||
target_link_libraries( | ||
${FILE_LINE} | ||
${CMAKE_THREAD_LIBS_INIT} | ||
${PROJECT_NAME}-static | ||
gtest | ||
gtest_main | ||
gmock | ||
gmock_main | ||
${GLOG_LIBRARIES} | ||
${GFLAGS_LIBRARIES} | ||
${sodium_LIBRARY_RELEASE} | ||
resolv | ||
util | ||
) | ||
add_test(${FILE_LINE} ${FILE_LINE}) | ||
endforeach() | ||
target_link_libraries( | ||
${PROJECT_NAME}-test | ||
TerminalCommon | ||
${PROJECT_NAME}-static | ||
${CMAKE_THREAD_LIBS_INIT} | ||
gtest | ||
gtest_main | ||
gmock | ||
gmock_main | ||
${GLOG_LIBRARIES} | ||
${GFLAGS_LIBRARIES} | ||
${sodium_LIBRARY_RELEASE} | ||
resolv | ||
util | ||
) | ||
add_test( | ||
${PROJECT_NAME}-test | ||
${PROJECT_NAME}-test | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "Headers.hpp" | ||
|
||
#include "gtest/gtest.h" | ||
|
||
int main(int argc, char **argv) { | ||
srand(1); | ||
google::InitGoogleLogging(argv[0]); | ||
gflags::ParseCommandLineFlags(&argc, &argv, true); | ||
testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_TESTS(); | ||
} |