The C++ version of the Gilded Rose refactoring kata is available in four variants using different test frameworks:
- Catch2 test framework
- Traditional unit test with the Catch2 test framework in the
test/cpp_catch2_unittest
folder. - Approval tests with the Catch2 test framework in the
test/cpp_catch2_approvaltest
folder.
- Traditional unit test with the Catch2 test framework in the
- Google Test framework
- Traditional unit test with the Googletest test framework in the
test/cpp_googletest_unittest
folder. - Approval tests with the Googletest test framework in the
test/cpp_googletest_approvaltest
folder.
- Traditional unit test with the Googletest test framework in the
The GildedRose.cc
file, i.e. the code under test, is identical in all four variants.
- CMake version >= 3.13
- C++ compiler that support C++11
$ cd ${GIT_FOLDER}/GildedRose-Refactoring-Kata/cpp
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .
$ cd ${GIT_FOLDER}/GildedRose-Refactoring-Kata/cpp/build
$ ctest -N
Test project ${GIT_FOLDER}/GildedRose-Refactoring-Kata/cpp/build
Test #1: GildedRoseCatch2ApprovalTests
Test #2: GildedRoseCatch2UnitTests
Test #3: GildedRoseGoogletestApprovalTests
Test #4: GildedRoseGoogletestUnitTests
$ ctest
$ ctest -VV
$ ctest -VV --tests-regex Catch2Approval
How to build and run tests using the CLion IDE
- Start CLion
- Select menu
File - Open...
- Select folder
${GIT_FOLDER}/GildedRose-Refactoring-Kata/cpp
- Select menu
Build - Build Project
- Select menu
Run - Run...
- Select what test variant to run, e.g.
GildedRoseCatch2ApprovalTests
.
- Start Visual Studio 2019
- Select
Open a local folder
- Select folder
${GIT_FOLDER}/GildedRose-Refactoring-Kata/cpp
- Wait for message
CMake generation finished.
in the CMake output window at the bottom - Select what test variant to run in the drop down menu for Startup Items, e.g.
GildedRoseCatch2ApprovalTests.exe
. - Select menu
Debug - Start