tags: c++ clion googletest gtest
wget https://github.com/google/googletest/archive/release-1.8.0.tar.gz && \
tar zxf release-1.8.0.tar.gz && \
rm -f release-1.8.0.tar.gz && \
cd googletest-release-1.8.0 && \
cmake configure . && \
make && \
make install
cmake_minimum_required(VERSION 3.9)
project(tennis_status)
set(CMAKE_CXX_STANDARD 17)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} gtest)
cmake_minimum_required(VERSION 3.9)
project(tennis)
set(CMAKE_CXX_STANDARD 17)
add_subdirectory(./googletest)
set(LIBRARIES
gtest
pthread)
add_executable(tennis main.cpp)
target_link_libraries(tennis ${LIBRARIES})
#include <iostream>
#include <gtest/gtest.h>
int add(int a, int b) {
return a + b;
}
TEST(test, c1) {
EXPECT_EQ(3, add(1, 2));
}
GTEST_API_ int main(int argc, char ** argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
After everything is configured, you should see an execute button in the cloin
Reference link
Simple example of GTest test project based on CLion
Unit testing framework GoogleTest Some time ago I learned and learned about Google's open source C ++ unit test framework Google Test, referred to as GTEST, very good. What we used to use was a set of...
1. Download and install CLion JB company official website to download to CLion https://www.jetbrains.com/clion/download/#section=windows The old version CLion address https://www.jetbrains.com/clion/d...
Use CLion to configure Cartographer_Superbuild I am a computer novice and tried to use CLion debug Cartographer, but encountered many difficulties, and finally used Cartographer_Superbuild written by ...
Must read before reading The methods on the Internet are mixed, and the solutions are half-understood. The author of this article found an optimal sequential method through a lot of search and practic...
Condition: Computer has been downloaded Xcode 1. Download Homebrew Homebrew is a MacOS, packet management tools under Linux, we need to use him to download GCC Download method: Open the terminal (TERM...
Results Eigen installed using HomeBrew After the installation is complete, the path should be If you are not sure or you can't find the following instructions, you can print out the path directly. The...
##Installing Clion Cross-platform IDE for C/C++ developers, providing excellent coding assistance, saving you a lot of time 1) Go to the following path and download the required version. CLion-2021.1....
title date comments categories tags permalink Common functions and usage of MAC system 2020/1/25 false Development environment Development software Configuration 1.3 1. Rename shortcut keys I'm used t...
Cygwin is a UNIX-like simulation environment that runs on the Windows platform. It provides a UNIX simulation DLL and a variety of software packages that can be found on Linux systems such as cmake. S...
1. Download the official website https://www.jetbrains.com/clion/ 2. Unzip tar -zxvf CLion-2016.2.2.tar.gz 3. Run ./download/clion-2018.1.1/bin/clion.sh 4. Go to http://idea.lanyus.com/ to get the act...