juk3n/fluffypublic Fork
⑂ 399709b
Commits
⬇ Clone ▾
git clone https://git.rickub.com/juk3n/fluffy.git
git clone ssh://git@rickub.com/juk3n/fluffy.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

added sample test

juk3n committed 2024-07-01T11:47:27+02:00 Browse files
399709b parent: 5584994
modified CMakeLists.txt +24 -2
@@ -17,6 +17,12 @@ if(NOT ftxui_POPULATED)
1717 endif()
1818
1919
20+FetchContent_Declare(googletest
21+ GIT_REPOSITORY https://github.com/google/googletest
22+ GIT_TAG v1.14.0
23+)
24+FetchContent_MakeAvailable(googletest)
25+
2026
2127 find_program(CLANG_TIDY NAMES "clang-tidy" REQUIRED)
2228 set(CLANG_TIDY_COMMAND "${CLANG_TIDY}" "-checks=-*,modernize-*")
@@ -25,10 +31,20 @@ set(CLANG_TIDY_COMMAND "${CLANG_TIDY}" "-checks=-*,modernize-*")
2531 find_package(SQLite3 REQUIRED)
2632
2733 include_directories(${CMAKE_SOURCE_DIR}/include)
28-
34+enable_testing()
2935 add_executable(fluffy src/main.cpp)
3036
3137
38+
39+add_executable(
40+ hello_test
41+ tests/tests.cc
42+)
43+target_link_libraries(
44+ hello_test
45+ GTest::gtest_main
46+)
47+
3248 target_link_libraries(fluffy
3349 PRIVATE ftxui::screen
3450 PRIVATE ftxui::dom
@@ -45,4 +61,10 @@ if (EMSCRIPTEN)
4561 foreach(file "index.html" "run_webassembly.py")
4662 configure_file("src/${file}" ${file})
4763 endforeach(file)
48-endif()
\ No newline at end of file
64+endif()
65+
66+
67+
68+
69+include(GoogleTest)
70+gtest_discover_tests(hello_test)
@@ -17,6 +17,12 @@ if(NOT ftxui_POPULATED)
17 endif()17 endif()
18 18
19 19
20+FetchContent_Declare(googletest
21+ GIT_REPOSITORY https://github.com/google/googletest
22+ GIT_TAG v1.14.0
23+)
24+FetchContent_MakeAvailable(googletest)
25+
20 26
21 find_program(CLANG_TIDY NAMES "clang-tidy" REQUIRED)27 find_program(CLANG_TIDY NAMES "clang-tidy" REQUIRED)
22 set(CLANG_TIDY_COMMAND "${CLANG_TIDY}" "-checks=-*,modernize-*")28 set(CLANG_TIDY_COMMAND "${CLANG_TIDY}" "-checks=-*,modernize-*")
@@ -25,10 +31,20 @@ set(CLANG_TIDY_COMMAND "${CLANG_TIDY}" "-checks=-*,modernize-*")
25 find_package(SQLite3 REQUIRED)31 find_package(SQLite3 REQUIRED)
26 32
27 include_directories(${CMAKE_SOURCE_DIR}/include)33 include_directories(${CMAKE_SOURCE_DIR}/include)
28-34+enable_testing()
29 add_executable(fluffy src/main.cpp)35 add_executable(fluffy src/main.cpp)
30 36
31 37
38+
39+add_executable(
40+ hello_test
41+ tests/tests.cc
42+)
43+target_link_libraries(
44+ hello_test
45+ GTest::gtest_main
46+)
47+
32 target_link_libraries(fluffy48 target_link_libraries(fluffy
33 PRIVATE ftxui::screen49 PRIVATE ftxui::screen
34 PRIVATE ftxui::dom50 PRIVATE ftxui::dom
@@ -45,4 +61,10 @@ if (EMSCRIPTEN)
45 foreach(file "index.html" "run_webassembly.py")61 foreach(file "index.html" "run_webassembly.py")
46 configure_file("src/${file}" ${file})62 configure_file("src/${file}" ${file})
47 endforeach(file)63 endforeach(file)
48-endif()
\ No newline at end of file\ No newline at end of file
64+endif()
65+
66+
67+
68+
69+include(GoogleTest)
70+gtest_discover_tests(hello_test)
added tests/tests.cc +9 -0
new file mode 100644
@@ -0,0 +1,9 @@
1+#include <gtest/gtest.h>
2+
3+// Demonstrate some basic assertions.
4+TEST(HelloTest, BasicAssertions) {
5+ // Expect two strings not to be equal.
6+ EXPECT_STRNE("hello", "world");
7+ // Expect equality.
8+ EXPECT_EQ(7 * 6, 42);
9+}
new file mode 100644
@@ -0,0 +1,9 @@
1+#include <gtest/gtest.h>
2+
3+// Demonstrate some basic assertions.
4+TEST(HelloTest, BasicAssertions) {
5+ // Expect two strings not to be equal.
6+ EXPECT_STRNE("hello", "world");
7+ // Expect equality.
8+ EXPECT_EQ(7 * 6, 42);
9+}