GildedRose-Refactoring-Kata/cpp/test/cpp_googletest_approvaltest/GildedRoseGoogletestApprovalTests.cc
tbeu 3bf108ef0e Restructure build targets of CMake configuration
* Rename the library under test from src to GildedRoseLib.
* Move the lib folder to test/third_party and handle ApprovalTests.hpp as header-only dependency.
* Remove the superfluous googletest_approval_main.cpp (in the same sense as there is only one GildedRoseCatch2ApprovalTests.cc)
* Set USE_FOLDERS property such that target ALL_BUILD, RUN_TESTS and ZERO_CHECK are grouped for Visual Studio.
* Set WORKING_DIRECTORY such that the RUN_TESTS target works successfully.
* Fix C++ language standard for Catch2 v3 to C++14.
* Bump third-party dependencies
  * Update ApprovalTests.hpp to v10.13.0
  * Update Catch2 to v3.8.0
  * Update GTest to v1.16.0
2025-02-11 23:04:23 +01:00

31 lines
773 B
C++

#define APPROVALS_GOOGLETEST
#include <ApprovalTests.hpp>
#include "GildedRose.h"
std::ostream& operator<<(std::ostream& os, const Item& obj)
{
return os
<< "name: " << obj.name
<< ", sellIn: " << obj.sellIn
<< ", quality: " << obj.quality;
}
TEST(GildedRoseApprovalTests, VerifyCombinations) {
std::vector<string> names { "Foo" };
std::vector<int> sellIns { 1 };
std::vector<int> qualities { 1 };
auto f = [](string name, int sellIn, int quality) {
vector<Item> items = {Item(name, sellIn, quality)};
GildedRose app(items);
app.updateQuality();
return items[0];
};
ApprovalTests::CombinationApprovals::verifyAllCombinations(
f,
names, sellIns, qualities);
}