Merge pull request #89 from anhvut/add_TexttestFixture_scala

add TexttestFixture.scala
This commit is contained in:
Emily Bache 2018-07-17 22:17:25 +02:00 committed by GitHub
commit a2a475838c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 1 deletions

View File

@ -1 +1 @@
sbt.version=0.13.13 sbt.version=1.1.6

View File

@ -0,0 +1,29 @@
package com.gildedrose
object TexttestFixture {
def main(args: Array[String]): Unit = {
var items = Array[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)
)
val app = new GildedRose(items)
val days = if (args.length > 0) args(0).toInt + 1 else 2
for (i <- 0 until days) {
System.out.println("-------- day " + i + " --------")
System.out.println("name, sellIn, quality")
for (item <- items) {
System.out.println(item.name + ", " + item.sellIn + ", " + item.quality)
}
System.out.println()
app.updateQuality()
}
}
}