mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 20:32:15 +00:00
Renamed main functions to TexttestFixture to make it clear they're not part of the actual refactoring kata
This commit is contained in:
parent
80bd31bea4
commit
32ce66e211
@ -1,35 +0,0 @@
|
||||
|
||||
public class Main {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
This Kata was originally created by Terry Hughes (http://twitter.com/#!/TerryHughes). It is already on GitHub as "GildedRose", a sample project for C#. I could have forked it again, but I thought other language users might not want to download a whole C# project environment. In this repository are starting code samples for Java, Python, Ruby, C# and C++.
|
||||
This Kata was originally created by Terry Hughes (http://twitter.com/#!/TerryHughes). It is already on GitHub as "GildedRose", a sample project for C#. I could have forked it again, but I thought other language users might not want to download a whole C# project environment. In this repository are starting code samples for Java, Python, Ruby, Smalltalk, C# and C++.
|
||||
|
||||
See also http://iamnotmyself.com/2011/02/13/refactor-this-the-gilded-rose-kata/
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
from __future__ import print_function
|
||||
|
||||
def update_quality(items):
|
||||
for item in items:
|
||||
@ -40,28 +39,3 @@ class Item:
|
||||
def __repr__(self):
|
||||
return "%s, %s, %s" % (self.name, self.sell_in, self.quality)
|
||||
|
||||
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)
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
#!/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
|
||||
@ -1,31 +1,31 @@
|
||||
full_name:Gilded Rose Refactoring Kata
|
||||
|
||||
# location where you have your clone
|
||||
default_checkout:/home/emily/workspace/Refactoring-Katas/GildedRose
|
||||
default_checkout:/Users/emily/training_materials/Refactoring-Katas/GildedRose
|
||||
|
||||
# Settings for the Java version
|
||||
#executable:Main
|
||||
#interpreter:java
|
||||
executable:TexttestFixture
|
||||
interpreter:java
|
||||
# note you'll also need to update the file environment.gr with your classpath if you keep your classfiles somewhere unusual
|
||||
|
||||
# Settings for the Python version
|
||||
#executable:${TEXTTEST_CHECKOUT}/python/gilded_rose.py
|
||||
#executable:${TEXTTEST_CHECKOUT}/python/texttest_fixture.py
|
||||
#interpreter:python
|
||||
|
||||
# Settings for the C++ version
|
||||
#executable:${TEXTTEST_CHECKOUT}/cpp/GildedRoseTextTests
|
||||
|
||||
# Settings for the Ruby version
|
||||
#executable:${TEXTTEST_CHECKOUT}/ruby/main.rb
|
||||
#executable:${TEXTTEST_CHECKOUT}/ruby/texttest_fixture.rb
|
||||
#interpreter:ruby
|
||||
|
||||
# Settings for the C# version
|
||||
executable:${TEXTTEST_CHECKOUT}/csharp/Program.exe
|
||||
#executable:${TEXTTEST_CHECKOUT}/csharp/Program.exe
|
||||
|
||||
# turn on one of these if you prefer them to notepad or emacs.
|
||||
[view_program]
|
||||
#*:mate
|
||||
*:gedit
|
||||
*:mate
|
||||
#*:gedit
|
||||
[end]
|
||||
|
||||
filename_convention_scheme:standard
|
||||
|
||||
Loading…
Reference in New Issue
Block a user