File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,21 @@ FetchContent_Declare(
18
18
set (gtest_force_shared_crt ON CACHE BOOL "" FORCE )
19
19
FetchContent_MakeAvailable (googletest )
20
20
21
+ # Reference: https://google.github.io/googletest/quickstart-cmake.html#create-and-run-a-binary
22
+ enable_testing ()
23
+
24
+ add_executable (
25
+ hello_test
26
+ hello_test.cc
27
+ )
28
+ target_link_libraries (
29
+ hello_test
30
+ GTest::gtest_main
31
+ )
32
+
33
+ include (GoogleTest )
34
+ gtest_discover_tests (hello_test )
35
+
21
36
# END - For setting up Google Test
22
37
###
23
38
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments