-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #527 from makaylas/testing
Gtest and a small example test
- Loading branch information
Showing
9 changed files
with
69 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "gtest"] | ||
path = gtest | ||
url = git@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
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
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,19 @@ | ||
if (NOT TARGET gtest) | ||
set(GOOGLETEST_ROOT ${CMAKE_SOURCE_DIR}/../gtest/googletest CACHE STRING "Google Test source root") | ||
|
||
include_directories(SYSTEM | ||
${GOOGLETEST_ROOT} | ||
${GOOGLETEST_ROOT}/include | ||
) | ||
|
||
set(GOOGLETEST_SOURCES | ||
${GOOGLETEST_ROOT}/src/gtest-all.cc | ||
${GOOGLETEST_ROOT}/src/gtest_main.cc | ||
) | ||
|
||
foreach(_source ${GOOGLETEST_SOURCES}) | ||
set_source_files_properties(${_source} PROPERTIES GENERATED 1) | ||
endforeach() | ||
|
||
add_library(gtest ${GOOGLETEST_SOURCES}) | ||
endif() |
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 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
|
||
add_dependencies(isis3 isis3) | ||
|
||
# Link runISISTests with what we want to test and the GTest and pthread library | ||
add_executable(runISISTests | ||
FileNameTests.cpp) | ||
|
||
target_link_libraries(runISISTests isis3 ${ALLLIBS} ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread) | ||
|
||
gtest_discover_tests(runISISTests WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/../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,18 @@ | ||
#include "FileName.h" | ||
|
||
#include <QString> | ||
|
||
#include <gtest/gtest.h> | ||
|
||
|
||
TEST(FileNameTests, BaseName) { | ||
QString test = "test.log"; | ||
Isis::FileName file(test); | ||
|
||
EXPECT_EQ("test", file.baseName()); | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
::testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_TESTS(); | ||
} |