File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ project(my_project)
33
44set (CMAKE_CXX_STANDARD 17)
55set (CMAKE_CXX_STANDARD_REQUIRED ON )
6+ add_compile_definitions (DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR} " )
67
78set (GTEST_DIR thirdparty/googletest)
89add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /../${GTEST_DIR} ${CMAKE_CURRENT_BINARY_DIR} /${GTEST_DIR} )
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include < gtest/gtest.h>
4+ #include < fstream>
5+ #include < filesystem>
6+
7+ std::string readFileStr (const std::string &fileName)
8+ {
9+ std::ifstream file (fileName);
10+ if (!file.is_open ()) {
11+ std::cout << " Failed to open " + fileName << std::endl;
12+ return " " ;
13+ }
14+
15+ std::stringstream buffer;
16+ buffer << file.rdbuf ();
17+ return buffer.str ();
18+ }
19+
20+ int main (int argc, char **argv)
21+ {
22+ std::filesystem::current_path (DATA_DIR);
23+ ::testing::InitGoogleTest (&argc, argv);
24+ return RUN_ALL_TESTS ();
25+ }
You can’t perform that action at this time.
0 commit comments