mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 04:12:13 +00:00
* Move "using namespace std;" from header to module file (to no longer pollute the global namespace). * Fix inconsistency of having namespace prefix in test code. * Add include guard to GildedRose.h. * Avoid std::endl. * Have consistent white-space.
31 lines
788 B
C++
31 lines
788 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<std::string> names { "Foo" };
|
|
std::vector<int> sellIns { 1 };
|
|
std::vector<int> qualities { 1 };
|
|
|
|
auto f = [](std::string name, int sellIn, int quality) {
|
|
std::vector<Item> items = {Item(name, sellIn, quality)};
|
|
GildedRose app(items);
|
|
app.updateQuality();
|
|
return items[0];
|
|
};
|
|
|
|
ApprovalTests::CombinationApprovals::verifyAllCombinations(
|
|
f,
|
|
names, sellIns, qualities);
|
|
|
|
}
|