-
-
Notifications
You must be signed in to change notification settings - Fork 987
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
1 parent
da4bd6c
commit 0783a97
Showing
8 changed files
with
52 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
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,14 @@ | ||
set(BINARY ${CMAKE_PROJECT_NAME}_test) | ||
|
||
set(TEST_SOURCES | ||
main.cpp | ||
test_main.cpp | ||
) | ||
|
||
add_executable(${BINARY} ${TEST_SOURCES}) | ||
|
||
add_test(NAME ${BINARY} COMMAND ${BINARY}) | ||
|
||
target_link_libraries(${BINARY} PUBLIC gtest) | ||
|
||
# target_include_directories(${BINARY} PRIVATE ${CMAKE_SOURCE_DIR}/third-party/googletest/googletest/include) |
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" | ||
|
||
int | ||
main(int argc, char **argv) { | ||
::testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_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,19 @@ | ||
/** | ||
* @file tests/test_main.cpp | ||
* @brief Test src/main.*. | ||
*/ | ||
|
||
#include "../src/main.h" | ||
#include "gtest/gtest.h" | ||
|
||
TEST(MainTestSuite, WriteFileTest) { | ||
EXPECT_EQ(write_file("write_file_test.txt", "test"), 0); | ||
} | ||
|
||
TEST(MainTestSuite, ReadFileTest) { | ||
// read file from WriteFileTest | ||
EXPECT_EQ(read_file("write_file_test.txt"), "test"); | ||
|
||
// read missing file | ||
EXPECT_EQ(read_file("non-existing-file.txt"), ""); | ||
} |
Submodule googletest
added at
f8d7d7
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