mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 04:12:13 +00:00
add more explicit approval test to cpp catch2 version
This commit is contained in:
parent
f42247354b
commit
661b131832
@ -1,10 +1,11 @@
|
||||
C++ version of Gilded Rose with Catch 2 and Approvals
|
||||
======================================================
|
||||
|
||||
This is a C++ start of the ApprovalTest version of the Gilded Rose Refactoring Kata. See
|
||||
This is a C++ start of the Gilded Rose Refactoring Kata. See
|
||||
the [top level readme](https://github.com/emilybache/GildedRose-Refactoring-Kata)
|
||||
for a general description of the exercise.
|
||||
|
||||
There are two (failing) unit tests included here. One uses only the catch2 framework, the other additionally uses [ApprovalTests](https://github.com/approvals/approvaltests.cpp). You should choose one of these tests to work with and delete the other.
|
||||
|
||||
CMake
|
||||
-----
|
||||
|
||||
@ -11,6 +11,7 @@ std::ostream& operator<<(std::ostream& os, const Item& obj)
|
||||
<< ", quality: " << obj.quality;
|
||||
}
|
||||
|
||||
// This is a normal unit test using Catch2
|
||||
TEST_CASE("UpdateQuality") {
|
||||
|
||||
vector<Item> items;
|
||||
@ -19,3 +20,13 @@ TEST_CASE("UpdateQuality") {
|
||||
app.updateQuality();
|
||||
REQUIRE("fixme" == app.items[0].name);
|
||||
}
|
||||
|
||||
// This is an Approval test using https://github.com/approvals/approvaltests.cpp
|
||||
TEST_CASE("UpdateQualityApprovalTest") {
|
||||
vector<Item> items;
|
||||
items.push_back(Item("foo", 0, 0));
|
||||
GildedRose app(items);
|
||||
app.updateQuality();
|
||||
auto item = app.items[0];
|
||||
ApprovalTests::Approvals::verify(item);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user