mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-11 20:02:09 +00:00
* Add testcase using https://github.com/approvals/ApprovalTests.cpp and google test. * Change google test to be downloaded if not installed with cmake * Add a run-once-cmake.sh script to build and test with cmake * Add a run-approval-once.sh script to build and run approval test
29 lines
867 B
C++
29 lines
867 B
C++
#include "ApprovalTests.v.2.0.0.hpp"
|
|
#include <gtest/gtest.h>
|
|
#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 };
|
|
|
|
CombinationApprovals::verifyAllCombinations<
|
|
std::vector<string>, std::vector<int>, std::vector<int>, Item>(
|
|
[](string name, int sellIn, int quality) {
|
|
vector<Item> items = {Item(name, sellIn, quality)};
|
|
GildedRose app(items);
|
|
app.updateQuality();
|
|
return items[0];
|
|
},
|
|
names, sellIns, qualities);
|
|
}
|