File tree Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ CMakeLists.txt.user
2
+ CMakeCache.txt
3
+ CMakeFiles
4
+ CMakeScripts
5
+ Testing
6
+ Makefile
7
+ cmake_install.cmake
8
+ install_manifest.txt
9
+ compile_commands.json
10
+ CTestTestfile.cmake
11
+ _deps
12
+ build
13
+ lib
14
+ bin
Original file line number Diff line number Diff line change
1
+ cmake_minimum_required (VERSION 3.14)
2
+ project (gtest)
3
+
4
+ # GoogleTest requires at least C++14
5
+ set (CMAKE_CXX_STANDARD 14)
6
+
7
+ include (FetchContent)
8
+ FetchContent_Declare(
9
+ googletest
10
+ URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
11
+ )
12
+ # For Windows: Prevent overriding the parent project's compiler/linker settings
13
+ set (gtest_force_shared_crt ON CACHE BOOL "" FORCE)
14
+ FetchContent_MakeAvailable(googletest)
15
+
16
+ enable_testing ()
17
+
18
+ add_executable (
19
+ hello_test
20
+ hello_test.cc
21
+ )
22
+ target_link_libraries (
23
+ hello_test
24
+ GTest::gtest_main
25
+ )
26
+
27
+ include (GoogleTest)
28
+ gtest_discover_tests(hello_test)
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