mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 04:12:13 +00:00
Added texttest
This commit is contained in:
parent
c56f013f1d
commit
975c5edd7f
38
GildedRose/cpp/GildedRoseTextTests.cc
Normal file
38
GildedRose/cpp/GildedRoseTextTests.cc
Normal file
@ -0,0 +1,38 @@
|
||||
#include "GildedRose.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ostream& operator<<(ostream& s, Item& item)
|
||||
{
|
||||
s << item.name << ", " << item.sellIn << ", " << item.quality;
|
||||
return s;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
vector<Item> items;
|
||||
items.push_back(Item("+5 Dexterity Vest", 10, 20));
|
||||
items.push_back(Item("Aged Brie", 2, 0));
|
||||
items.push_back(Item("Elixir of the Mongoose", 5, 7));
|
||||
items.push_back(Item("Sulfuras, Hand of Ragnaros", 0, 80));
|
||||
items.push_back(Item("Backstage passes to a TAFKAL80ETC concert", 15, 20));
|
||||
items.push_back(Item("Conjured Mana Cake", 3, 6));
|
||||
GildedRose app(items);
|
||||
|
||||
cout << "OMGHAI!" << endl;
|
||||
|
||||
for (int day = 0; day <= 30; day++)
|
||||
{
|
||||
cout << "-------- day " << day << " --------" << endl;
|
||||
cout << "name, sellIn, quality" << endl;
|
||||
for (vector<Item>::iterator i = items.begin(); i != items.end(); i++)
|
||||
{
|
||||
cout << *i << endl;
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
app.updateQuality();
|
||||
}
|
||||
}
|
||||
@ -27,6 +27,8 @@ CXXFLAGS += -g -Wall -Wextra
|
||||
# created to the list.
|
||||
TESTS = GildedRose
|
||||
|
||||
TEXTTESTS = GildedRoseTextTests
|
||||
|
||||
# All Google Test headers. Usually you shouldn't change this
|
||||
# definition.
|
||||
GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \
|
||||
@ -34,10 +36,10 @@ GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \
|
||||
|
||||
# House-keeping build targets.
|
||||
|
||||
all : $(TESTS)
|
||||
all : $(TESTS) $(TEXTTESTS)
|
||||
|
||||
clean :
|
||||
rm -f $(TESTS) gtest.a gtest_main.a *.o
|
||||
rm -f $(TESTS) $(TEXTTESTS) gtest.a gtest_main.a *.o
|
||||
|
||||
# Builds gtest.a and gtest_main.a.
|
||||
|
||||
@ -76,3 +78,9 @@ GildedRoseUnitTests.o : $(USER_DIR)/GildedRoseUnitTests.cc \
|
||||
|
||||
GildedRose : GildedRoseUnitTests.o GildedRose.o gtest_main.a
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -pthread $^ -o $@
|
||||
|
||||
GildedRoseTextTests.o : $(USER_DIR)/GildedRoseTextTests.cc
|
||||
$(CXX) -c $(USER_DIR)/GildedRoseTextTests.cc
|
||||
|
||||
GildedRoseTextTests : GildedRoseTextTests.o GildedRose.o
|
||||
$(CXX) -pthread $^ -o $@
|
||||
|
||||
Loading…
Reference in New Issue
Block a user