Skip to content

LearnWithLlew/TestingFunctionalCodeKata.cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scenario

The TrigMath.h file has been in production for a long time now, and proven to be a reliable library. We want to get it properly tested, as we want to make some changes in the future.

Goal

The goal here is to get 100% of the lines unit-tested in the code TrigMath.h.

How-To

In Test.cpp, we have written the first test for you. Warning: It does not pass.

Get it to pass. Then write some more tests. You should never be changing anything in TrigMath.h.

It is highly suggested that you use some form of code coverage tool in the editor, so that you can see what your next step is.

How to Test NaNs

TODO Add background on NaN

    CHECK(std::isnan(NAN));

Setting up and running with code coverage

CLion on Unix

  • TODO Add more info

MS Visual Studio

  • Install OpenCppCoverage from the Market Place
  • TODO Add more info

Run from command line

These are the two commands I run to on my computer

/Applications/CLion.app/Contents/bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /Users/llewellyn/Github/TestingFunctionalCodeKata.cpp
./cmake-build-debug/tests/TestingFunctionalCodeKataTests

About

Kata to learn to test functional code in c++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published