-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Google Testing Support to Bunny Mesh
- Loading branch information
1 parent
a0a2290
commit 1b228d4
Showing
7 changed files
with
107 additions
and
1 deletion.
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
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,20 @@ | ||
# code copied from https://crascit.com/2015/07/25/cmake-gtest/ | ||
cmake_minimum_required(VERSION 3.5 FATAL_ERROR) | ||
|
||
project(googletest-download NONE) | ||
|
||
include(ExternalProject) | ||
|
||
ExternalProject_Add( | ||
googletest | ||
SOURCE_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-src" | ||
BINARY_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-build" | ||
GIT_REPOSITORY | ||
https://github.com/google/googletest.git | ||
GIT_TAG | ||
release-1.8.0 | ||
CONFIGURE_COMMAND "" | ||
BUILD_COMMAND "" | ||
INSTALL_COMMAND "" | ||
TEST_COMMAND "" | ||
) |
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,32 @@ | ||
# the following code to fetch googletest | ||
# is inspired by and adapted after https://crascit.com/2015/07/25/cmake-gtest/ | ||
# download and unpack googletest at configure time | ||
|
||
macro(fetch_googletest _download_module_path _download_root) | ||
set(GOOGLETEST_DOWNLOAD_ROOT ${_download_root}) | ||
configure_file( | ||
${_download_module_path}/googletest-download.cmake | ||
${_download_root}/CMakeLists.txt | ||
@ONLY | ||
) | ||
unset(GOOGLETEST_DOWNLOAD_ROOT) | ||
|
||
execute_process( | ||
COMMAND | ||
"${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . | ||
WORKING_DIRECTORY | ||
${_download_root} | ||
) | ||
execute_process( | ||
COMMAND | ||
"${CMAKE_COMMAND}" --build . | ||
WORKING_DIRECTORY | ||
${_download_root} | ||
) | ||
|
||
# adds the targers: gtest, gtest_main, gmock, gmock_main | ||
add_subdirectory( | ||
${_download_root}/googletest-src | ||
${_download_root}/googletest-build | ||
) | ||
endmacro() |
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,5 @@ | ||
#!/bin/bash | ||
|
||
echo 'Runnin Bunny Mesh Tests...' | ||
|
||
./build/bin/bunny_tests |
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,24 @@ | ||
add_executable( | ||
bunny_tests | ||
test_Mesh.cc | ||
test_IO.cc | ||
) | ||
|
||
target_link_libraries( | ||
bunny_tests | ||
bunny_mesh | ||
gtest_main | ||
) | ||
|
||
target_include_directories( | ||
bunny_tests | ||
PUBLIC | ||
${CMAKE_HOME_DIRECTORY}/include | ||
) | ||
|
||
add_test( | ||
NAME | ||
unit | ||
COMMAND | ||
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/unit_tests | ||
) |
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,7 @@ | ||
#include "gtest/gtest.h" | ||
#include "bunny_mesh/data_io.h" | ||
|
||
TEST(IO, positive) | ||
{ | ||
ASSERT_TRUE(true); | ||
} |
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,7 @@ | ||
#include "gtest/gtest.h" | ||
#include "bunny_mesh/Mesh.h" | ||
|
||
TEST(Mesh, positive) | ||
{ | ||
ASSERT_TRUE(true); | ||
} |