From 80bd31bea40883b894910c512820d9b800c2f436 Mon Sep 17 00:00:00 2001 From: Emily Bache Date: Thu, 24 May 2012 14:21:21 +0200 Subject: [PATCH] changing names to Fixture so that it's obvious this code is not part of the refactoring kata itself --- GildedRose/Java/TexttestFixture.java | 35 +++++++++++++++++++++++++++ GildedRose/python/texttest_fixture.py | 29 ++++++++++++++++++++++ GildedRose/ruby/texttest_fixture.rb | 33 +++++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100755 GildedRose/Java/TexttestFixture.java create mode 100644 GildedRose/python/texttest_fixture.py create mode 100644 GildedRose/ruby/texttest_fixture.rb diff --git a/GildedRose/Java/TexttestFixture.java b/GildedRose/Java/TexttestFixture.java new file mode 100755 index 00000000..3f48d3aa --- /dev/null +++ b/GildedRose/Java/TexttestFixture.java @@ -0,0 +1,35 @@ + +public class TexttestFixture { + public static void main(String[] args) { + System.out.println("OMGHAI!"); + + Item[] items = new Item[] { new Item("+5 Dexterity Vest", 10, 20), + new Item("Aged Brie", 2, 0), + new Item("Elixir of the Mongoose", 5, 7), + new Item("Sulfuras, Hand of Ragnaros", 0, 80), + new Item("Sulfuras, Hand of Ragnaros", -1, 80), + new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), + new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), + new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), + // this conjured item does not work properly yet + new Item("Conjured Mana Cake", 3, 6) }; + + GildedRose app = new GildedRose(items); + + int days = 2; + if (args.length > 0) { + days = Integer.parseInt(args[0]) + 1; + } + + for (int i = 0; i < days; i++) { + System.out.println("-------- day " + i + " --------"); + System.out.println("name, sellIn, quality"); + for (Item item : items) { + System.out.println(item); + } + System.out.println(); + app.updateQuality(); + } + } + +} \ No newline at end of file diff --git a/GildedRose/python/texttest_fixture.py b/GildedRose/python/texttest_fixture.py new file mode 100644 index 00000000..b85634c1 --- /dev/null +++ b/GildedRose/python/texttest_fixture.py @@ -0,0 +1,29 @@ +from __future__ import print_function + +from gilded_rose import * + +if __name__ == "__main__": + print ("OMGHAI!") + items = [ + Item(name="+5 Dexterity Vest", sell_in=10, quality=20), + Item(name="Aged Brie", sell_in=2, quality=0), + Item(name="Elixir of the Mongoose", sell_in=5, quality=7), + Item(name="Sulfuras, Hand of Ragnaros", sell_in=0, quality=80), + Item(name="Sulfuras, Hand of Ragnaros", sell_in=-1, quality=80), + Item(name="Backstage passes to a TAFKAL80ETC concert", sell_in=15, quality=20), + Item(name="Backstage passes to a TAFKAL80ETC concert", sell_in=10, quality=49), + Item(name="Backstage passes to a TAFKAL80ETC concert", sell_in=5, quality=49), + Item(name="Conjured Mana Cake", sell_in=3, quality=6), # <-- :O + ] + + days = 2 + import sys + if len(sys.argv) > 1: + days = int(sys.argv[1]) + 1 + for day in range(days): + print("-------- day %s --------" % day) + print("name, sellIn, quality") + for item in items: + print(item) + print("") + update_quality(items) diff --git a/GildedRose/ruby/texttest_fixture.rb b/GildedRose/ruby/texttest_fixture.rb new file mode 100644 index 00000000..c639c06b --- /dev/null +++ b/GildedRose/ruby/texttest_fixture.rb @@ -0,0 +1,33 @@ +#!/usr/bin/ruby -w + +require File.join(File.dirname(__FILE__), 'gilded_rose') + +puts "OMGHAI!" +items = [ + Item.new(name="+5 Dexterity Vest", sell_in=10, quality=20), + Item.new(name="Aged Brie", sell_in=2, quality=0), + Item.new(name="Elixir of the Mongoose", sell_in=5, quality=7), + Item.new(name="Sulfuras, Hand of Ragnaros", sell_in=0, quality=80), + Item.new(name="Sulfuras, Hand of Ragnaros", sell_in=-1, quality=80), + Item.new(name="Backstage passes to a TAFKAL80ETC concert", sell_in=15, quality=20), + Item.new(name="Backstage passes to a TAFKAL80ETC concert", sell_in=10, quality=49), + Item.new(name="Backstage passes to a TAFKAL80ETC concert", sell_in=5, quality=49), + # This Conjured item does not work properly yet + Item.new(name="Conjured Mana Cake", sell_in=3, quality=6), # <-- :O + ] + +days = 2 +if ARGV.size > 0 + days = ARGV[0].to_i + 1 +end + +gilded_rose = GildedRose.new +(0...days).each do |day| + puts "-------- day #{day} --------" + puts "name, sellIn, quality" + items.each do |item| + puts item + end + puts "" + gilded_rose.update_quality(items) +end