[go: up one dir, main page]

Skip to content

gyoce/Tests_CPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test your C++ code with GoogleTest

Test

This is a repo to help you start your journey about testing your C++ code with GoogleTest and CMake with >= C++14.

This repo depends on GoogleTest.

Explanations

.

- - src

- - - - MyProject

- - - - - - src

- - - - - - - - MyClass.cpp

- - - - - - - - MyClass.hpp

- - - - - - CMakeLists.txt <- define library MyLibrary

- - - - Main.cpp

- - - - CMakeLists.txt <- use MyLibrary & define main executable

- - tests

- - - - UnitTests

- - - - - - MyClassTest.cpp

- - - - CMakeLists.txt <- use MyLibrary & define test executable

How to clone

git clone --recurse-submodules https://github.com/gyoce/Tests_CPP.git

How to build with CMake CLI

mkdir build
cd build
cmake ..
cmake --build .

How to build with Visual Studio :

  1. Open the directory in Visual Studio
  2. Press CTRL + SHIFT + B

How to run inside terminal :

After building run the main executable with :

./[PATH_TO]/CPP.exe

You can run test with the command (inside the build directory) :

ctest

How to run with Visual Studio :

  1. Open the directory in Visual Studio
  2. Select Startup Item (CPP.exe for main & CPPTests.exe for tests)

Exemple with Visual Studio 17 2022 Generator & CMake CLI

mkdir build
cd build
cmake .. -G "Visual Studio 17 2022"
cmake --build .
ctest

About

Test your C++ code with GoogleTest

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published