Merge pull request #3 from ovitrif/feature/refactor-text-tests

- Replace texttest with simplified solution for acceptance tests
- Restructure project 
- Update dependencies
- Add assertj library
This commit is contained in:
Ovi Trif 2018-10-05 20:32:19 +02:00 committed by GitHub
commit f9a23a4949
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 378 additions and 512 deletions

View File

@ -1,35 +1,22 @@
buildscript {
ext.kotlin_version = '1.2.21'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id "org.jetbrains.kotlin.jvm" version "1.2.21"
id 'org.jetbrains.kotlin.jvm' version '1.2.71'
}
apply plugin: 'kotlin'
version '1.0.0'
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testCompile 'junit:junit:4.12'
}
repositories {
mavenCentral()
}
dependencies {
compile 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71'
testCompile 'junit:junit:4.12'
testCompile "org.assertj:assertj-core:3.8.0"
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
kotlinOptions.jvmTarget = '1.8'
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
kotlinOptions.jvmTarget = '1.8'
}

Binary file not shown.

View File

@ -1,5 +1,6 @@
#Fri Oct 05 12:30:37 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip

1
settings.gradle Normal file
View File

@ -0,0 +1 @@
rootProject.name = 'gildedrose'

View File

@ -1,36 +0,0 @@
package com.gildedrose
fun main(args: Array<String>) {
println("OMGHAI!")
val items = arrayOf(Item("+5 Dexterity Vest", 10, 20), //
Item("Aged Brie", 2, 0), //
Item("Elixir of the Mongoose", 5, 7), //
Item("Sulfuras, Hand of Ragnaros", 0, 80), //
Item("Sulfuras, Hand of Ragnaros", -1, 80),
Item("Backstage passes to a TAFKAL80ETC concert", 15, 20),
Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
// this conjured item does not work properly yet
Item("Conjured Mana Cake", 3, 6))
val app = GildedRose(items)
var days = 2
if (args.size > 0) {
days = Integer.parseInt(args[0]) + 1
}
for (i in 0..days - 1) {
println("-------- day $i --------")
println("name, sellIn, quality")
for (item in items) {
println(item)
}
println()
app.updateQuality()
}
}

View File

@ -0,0 +1,50 @@
package com.gildedrose.acceptance
import com.gildedrose.GildedRose
import com.gildedrose.Item
import com.gildedrose.core.TestToFileHandler
import org.junit.Assert.assertEquals
import org.junit.Test
class ThirtyDaysAcceptanceTests {
private val testToFileHandler = TestToFileHandler("ThirtyDays")
@Test
fun withInitialTextFixture_whenRunForThirtyDays_itShouldHaveSameOutputAsLegacyCode() {
val initialTextFixture = arrayOf(
Item("+5 Dexterity Vest", 10, 20), //
Item("Aged Brie", 2, 0), //
Item("Elixir of the Mongoose", 5, 7), //
Item("Sulfuras, Hand of Ragnaros", 0, 80), //
Item("Sulfuras, Hand of Ragnaros", -1, 80),
Item("Backstage passes to a TAFKAL80ETC concert", 15, 20),
Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
// this conjured item does not work properly yet
Item("Conjured Mana Cake", 3, 6))
val output = runWithItemsForDays(initialTextFixture, 30)
assertEquals(output, testToFileHandler.read())
}
private fun runWithItemsForDays(items: Array<Item>, days: Int): String {
var output = ""
val app = GildedRose(items)
for (i in 0 until days) {
output += "\nDAY $i\n"
items.forEach {
val newLine = if (it == items.last()) "" else "\n"
output += "$it$newLine"
}
app.updateQuality()
}
return output
}
}

View File

@ -0,0 +1,13 @@
package com.gildedrose.core
import java.io.File
class TestToFileHandler(
fileName: String) {
val filePath = "texttest/$fileName.txt"
fun write(text: String) = File(filePath).bufferedWriter().use { it.write(text) }
fun read() = File(filePath).bufferedReader().readLines().joinToString(separator = "\n")
}

301
texttest/ThirtyDays.txt Normal file
View File

@ -0,0 +1,301 @@
DAY 0
Item(name=+5 Dexterity Vest, sellIn=10, quality=20)
Item(name=Aged Brie, sellIn=2, quality=0)
Item(name=Elixir of the Mongoose, sellIn=5, quality=7)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=15, quality=20)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=10, quality=49)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=5, quality=49)
Item(name=Conjured Mana Cake, sellIn=3, quality=6)
DAY 1
Item(name=+5 Dexterity Vest, sellIn=9, quality=19)
Item(name=Aged Brie, sellIn=1, quality=1)
Item(name=Elixir of the Mongoose, sellIn=4, quality=6)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=14, quality=21)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=9, quality=50)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=4, quality=50)
Item(name=Conjured Mana Cake, sellIn=2, quality=5)
DAY 2
Item(name=+5 Dexterity Vest, sellIn=8, quality=18)
Item(name=Aged Brie, sellIn=0, quality=2)
Item(name=Elixir of the Mongoose, sellIn=3, quality=5)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=13, quality=22)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=8, quality=50)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=3, quality=50)
Item(name=Conjured Mana Cake, sellIn=1, quality=4)
DAY 3
Item(name=+5 Dexterity Vest, sellIn=7, quality=17)
Item(name=Aged Brie, sellIn=-1, quality=4)
Item(name=Elixir of the Mongoose, sellIn=2, quality=4)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=12, quality=23)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=7, quality=50)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=2, quality=50)
Item(name=Conjured Mana Cake, sellIn=0, quality=3)
DAY 4
Item(name=+5 Dexterity Vest, sellIn=6, quality=16)
Item(name=Aged Brie, sellIn=-2, quality=6)
Item(name=Elixir of the Mongoose, sellIn=1, quality=3)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=11, quality=24)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=6, quality=50)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=1, quality=50)
Item(name=Conjured Mana Cake, sellIn=-1, quality=1)
DAY 5
Item(name=+5 Dexterity Vest, sellIn=5, quality=15)
Item(name=Aged Brie, sellIn=-3, quality=8)
Item(name=Elixir of the Mongoose, sellIn=0, quality=2)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=10, quality=25)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=5, quality=50)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=0, quality=50)
Item(name=Conjured Mana Cake, sellIn=-2, quality=0)
DAY 6
Item(name=+5 Dexterity Vest, sellIn=4, quality=14)
Item(name=Aged Brie, sellIn=-4, quality=10)
Item(name=Elixir of the Mongoose, sellIn=-1, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=9, quality=27)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=4, quality=50)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-1, quality=0)
Item(name=Conjured Mana Cake, sellIn=-3, quality=0)
DAY 7
Item(name=+5 Dexterity Vest, sellIn=3, quality=13)
Item(name=Aged Brie, sellIn=-5, quality=12)
Item(name=Elixir of the Mongoose, sellIn=-2, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=8, quality=29)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=3, quality=50)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-2, quality=0)
Item(name=Conjured Mana Cake, sellIn=-4, quality=0)
DAY 8
Item(name=+5 Dexterity Vest, sellIn=2, quality=12)
Item(name=Aged Brie, sellIn=-6, quality=14)
Item(name=Elixir of the Mongoose, sellIn=-3, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=7, quality=31)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=2, quality=50)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-3, quality=0)
Item(name=Conjured Mana Cake, sellIn=-5, quality=0)
DAY 9
Item(name=+5 Dexterity Vest, sellIn=1, quality=11)
Item(name=Aged Brie, sellIn=-7, quality=16)
Item(name=Elixir of the Mongoose, sellIn=-4, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=6, quality=33)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=1, quality=50)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-4, quality=0)
Item(name=Conjured Mana Cake, sellIn=-6, quality=0)
DAY 10
Item(name=+5 Dexterity Vest, sellIn=0, quality=10)
Item(name=Aged Brie, sellIn=-8, quality=18)
Item(name=Elixir of the Mongoose, sellIn=-5, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=5, quality=35)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=0, quality=50)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-5, quality=0)
Item(name=Conjured Mana Cake, sellIn=-7, quality=0)
DAY 11
Item(name=+5 Dexterity Vest, sellIn=-1, quality=8)
Item(name=Aged Brie, sellIn=-9, quality=20)
Item(name=Elixir of the Mongoose, sellIn=-6, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=4, quality=38)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-1, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-6, quality=0)
Item(name=Conjured Mana Cake, sellIn=-8, quality=0)
DAY 12
Item(name=+5 Dexterity Vest, sellIn=-2, quality=6)
Item(name=Aged Brie, sellIn=-10, quality=22)
Item(name=Elixir of the Mongoose, sellIn=-7, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=3, quality=41)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-2, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-7, quality=0)
Item(name=Conjured Mana Cake, sellIn=-9, quality=0)
DAY 13
Item(name=+5 Dexterity Vest, sellIn=-3, quality=4)
Item(name=Aged Brie, sellIn=-11, quality=24)
Item(name=Elixir of the Mongoose, sellIn=-8, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=2, quality=44)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-3, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-8, quality=0)
Item(name=Conjured Mana Cake, sellIn=-10, quality=0)
DAY 14
Item(name=+5 Dexterity Vest, sellIn=-4, quality=2)
Item(name=Aged Brie, sellIn=-12, quality=26)
Item(name=Elixir of the Mongoose, sellIn=-9, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=1, quality=47)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-4, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-9, quality=0)
Item(name=Conjured Mana Cake, sellIn=-11, quality=0)
DAY 15
Item(name=+5 Dexterity Vest, sellIn=-5, quality=0)
Item(name=Aged Brie, sellIn=-13, quality=28)
Item(name=Elixir of the Mongoose, sellIn=-10, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=0, quality=50)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-5, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-10, quality=0)
Item(name=Conjured Mana Cake, sellIn=-12, quality=0)
DAY 16
Item(name=+5 Dexterity Vest, sellIn=-6, quality=0)
Item(name=Aged Brie, sellIn=-14, quality=30)
Item(name=Elixir of the Mongoose, sellIn=-11, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-1, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-6, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-11, quality=0)
Item(name=Conjured Mana Cake, sellIn=-13, quality=0)
DAY 17
Item(name=+5 Dexterity Vest, sellIn=-7, quality=0)
Item(name=Aged Brie, sellIn=-15, quality=32)
Item(name=Elixir of the Mongoose, sellIn=-12, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-2, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-7, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-12, quality=0)
Item(name=Conjured Mana Cake, sellIn=-14, quality=0)
DAY 18
Item(name=+5 Dexterity Vest, sellIn=-8, quality=0)
Item(name=Aged Brie, sellIn=-16, quality=34)
Item(name=Elixir of the Mongoose, sellIn=-13, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-3, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-8, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-13, quality=0)
Item(name=Conjured Mana Cake, sellIn=-15, quality=0)
DAY 19
Item(name=+5 Dexterity Vest, sellIn=-9, quality=0)
Item(name=Aged Brie, sellIn=-17, quality=36)
Item(name=Elixir of the Mongoose, sellIn=-14, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-4, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-9, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-14, quality=0)
Item(name=Conjured Mana Cake, sellIn=-16, quality=0)
DAY 20
Item(name=+5 Dexterity Vest, sellIn=-10, quality=0)
Item(name=Aged Brie, sellIn=-18, quality=38)
Item(name=Elixir of the Mongoose, sellIn=-15, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-5, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-10, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-15, quality=0)
Item(name=Conjured Mana Cake, sellIn=-17, quality=0)
DAY 21
Item(name=+5 Dexterity Vest, sellIn=-11, quality=0)
Item(name=Aged Brie, sellIn=-19, quality=40)
Item(name=Elixir of the Mongoose, sellIn=-16, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-6, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-11, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-16, quality=0)
Item(name=Conjured Mana Cake, sellIn=-18, quality=0)
DAY 22
Item(name=+5 Dexterity Vest, sellIn=-12, quality=0)
Item(name=Aged Brie, sellIn=-20, quality=42)
Item(name=Elixir of the Mongoose, sellIn=-17, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-7, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-12, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-17, quality=0)
Item(name=Conjured Mana Cake, sellIn=-19, quality=0)
DAY 23
Item(name=+5 Dexterity Vest, sellIn=-13, quality=0)
Item(name=Aged Brie, sellIn=-21, quality=44)
Item(name=Elixir of the Mongoose, sellIn=-18, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-8, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-13, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-18, quality=0)
Item(name=Conjured Mana Cake, sellIn=-20, quality=0)
DAY 24
Item(name=+5 Dexterity Vest, sellIn=-14, quality=0)
Item(name=Aged Brie, sellIn=-22, quality=46)
Item(name=Elixir of the Mongoose, sellIn=-19, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-9, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-14, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-19, quality=0)
Item(name=Conjured Mana Cake, sellIn=-21, quality=0)
DAY 25
Item(name=+5 Dexterity Vest, sellIn=-15, quality=0)
Item(name=Aged Brie, sellIn=-23, quality=48)
Item(name=Elixir of the Mongoose, sellIn=-20, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-10, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-15, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-20, quality=0)
Item(name=Conjured Mana Cake, sellIn=-22, quality=0)
DAY 26
Item(name=+5 Dexterity Vest, sellIn=-16, quality=0)
Item(name=Aged Brie, sellIn=-24, quality=50)
Item(name=Elixir of the Mongoose, sellIn=-21, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-11, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-16, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-21, quality=0)
Item(name=Conjured Mana Cake, sellIn=-23, quality=0)
DAY 27
Item(name=+5 Dexterity Vest, sellIn=-17, quality=0)
Item(name=Aged Brie, sellIn=-25, quality=50)
Item(name=Elixir of the Mongoose, sellIn=-22, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-12, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-17, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-22, quality=0)
Item(name=Conjured Mana Cake, sellIn=-24, quality=0)
DAY 28
Item(name=+5 Dexterity Vest, sellIn=-18, quality=0)
Item(name=Aged Brie, sellIn=-26, quality=50)
Item(name=Elixir of the Mongoose, sellIn=-23, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-13, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-18, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-23, quality=0)
Item(name=Conjured Mana Cake, sellIn=-25, quality=0)
DAY 29
Item(name=+5 Dexterity Vest, sellIn=-19, quality=0)
Item(name=Aged Brie, sellIn=-27, quality=50)
Item(name=Elixir of the Mongoose, sellIn=-24, quality=0)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=0, quality=80)
Item(name=Sulfuras, Hand of Ragnaros, sellIn=-1, quality=80)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-14, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-19, quality=0)
Item(name=Backstage passes to a TAFKAL80ETC concert, sellIn=-24, quality=0)
Item(name=Conjured Mana Cake, sellIn=-26, quality=0)

View File

@ -1,37 +0,0 @@
# TextTest regression tests
This folder contains Text-Based tests for the GildedRose Refactoring Kata.
These tests are designed to be used with the open source testing tool "TextTest", available from http://texttest.org You can run them without it too though, see below.
## Running without TextTest
This should be perfectly possible, but is probably less convenient than using TextTest.
Write a script that will execute the SUT (see "config.gr" for details of the executables), giving the commandline options listed in "options.gr". Collect the output from standard output in a file, and diff that against the golden copy "stdout.gr". Any diff is a test failure.
## Running with TextTest
- Install TextTest (see http://texttest.org)
- set $TEXTTEST_HOME environment variable to point at the "texttests" folder
- run texttest using a command like "python texttest.py -a gr"
This should start the GUI for the TextTest tool.
Each test case has it's own subdirectory. The name of the directory is the name of the test - in this case "ThirtyDays". The "Golden Copy" of the output for that test case is kept in that directory. In this case we have three files:
- __stderr.gr__ - the expected output to Standard Error (stderr)
- __stdout.gr__ - the expected output to Standard Output (stdout)
- __options.gr__ - the options to give on the command line when you run the System Under Test (SUT)
In the directory above, there are configuration files for TextTest:
- __config.gr__ - this tells TextTest where to find the SUT executable, and sets up options for how it runs the SUT and interprets the output.
- __environment.gr__ - this file lists environment variables that will be set before TextTest runs the SUT. This is especially important for Java applications, that must set the CLASSPATH environment variable in order to run properly.
- __testsuite.gr__ - lists the constituent test cases of this suite. Change the order of the entries here to change the order they appear in the TextTest GUI.
To run a test, click on it in the GUI and select "Run". TextTest will run it in a temporary (sandbox) directory and report the results. If the test fails, you can double click on a file to see the diff against the Golden Copy.
If you run into difficulties with TextTest, there is documentation available on [texttest.org](http://texttest.org), or you can ask a question on the [mailing list](https://lists.sourceforge.net/lists/listinfo/texttest-users).

Binary file not shown.

View File

@ -1 +0,0 @@
30

View File

@ -1,373 +0,0 @@
OMGHAI!
-------- day 0 --------
name, sellIn, quality
+5 Dexterity Vest, 10, 20
Aged Brie, 2, 0
Elixir of the Mongoose, 5, 7
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 15, 20
Backstage passes to a TAFKAL80ETC concert, 10, 49
Backstage passes to a TAFKAL80ETC concert, 5, 49
Conjured Mana Cake, 3, 6
-------- day 1 --------
name, sellIn, quality
+5 Dexterity Vest, 9, 19
Aged Brie, 1, 1
Elixir of the Mongoose, 4, 6
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 14, 21
Backstage passes to a TAFKAL80ETC concert, 9, 50
Backstage passes to a TAFKAL80ETC concert, 4, 50
Conjured Mana Cake, 2, 5
-------- day 2 --------
name, sellIn, quality
+5 Dexterity Vest, 8, 18
Aged Brie, 0, 2
Elixir of the Mongoose, 3, 5
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 13, 22
Backstage passes to a TAFKAL80ETC concert, 8, 50
Backstage passes to a TAFKAL80ETC concert, 3, 50
Conjured Mana Cake, 1, 4
-------- day 3 --------
name, sellIn, quality
+5 Dexterity Vest, 7, 17
Aged Brie, -1, 4
Elixir of the Mongoose, 2, 4
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 12, 23
Backstage passes to a TAFKAL80ETC concert, 7, 50
Backstage passes to a TAFKAL80ETC concert, 2, 50
Conjured Mana Cake, 0, 3
-------- day 4 --------
name, sellIn, quality
+5 Dexterity Vest, 6, 16
Aged Brie, -2, 6
Elixir of the Mongoose, 1, 3
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 11, 24
Backstage passes to a TAFKAL80ETC concert, 6, 50
Backstage passes to a TAFKAL80ETC concert, 1, 50
Conjured Mana Cake, -1, 1
-------- day 5 --------
name, sellIn, quality
+5 Dexterity Vest, 5, 15
Aged Brie, -3, 8
Elixir of the Mongoose, 0, 2
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 10, 25
Backstage passes to a TAFKAL80ETC concert, 5, 50
Backstage passes to a TAFKAL80ETC concert, 0, 50
Conjured Mana Cake, -2, 0
-------- day 6 --------
name, sellIn, quality
+5 Dexterity Vest, 4, 14
Aged Brie, -4, 10
Elixir of the Mongoose, -1, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 9, 27
Backstage passes to a TAFKAL80ETC concert, 4, 50
Backstage passes to a TAFKAL80ETC concert, -1, 0
Conjured Mana Cake, -3, 0
-------- day 7 --------
name, sellIn, quality
+5 Dexterity Vest, 3, 13
Aged Brie, -5, 12
Elixir of the Mongoose, -2, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 8, 29
Backstage passes to a TAFKAL80ETC concert, 3, 50
Backstage passes to a TAFKAL80ETC concert, -2, 0
Conjured Mana Cake, -4, 0
-------- day 8 --------
name, sellIn, quality
+5 Dexterity Vest, 2, 12
Aged Brie, -6, 14
Elixir of the Mongoose, -3, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 7, 31
Backstage passes to a TAFKAL80ETC concert, 2, 50
Backstage passes to a TAFKAL80ETC concert, -3, 0
Conjured Mana Cake, -5, 0
-------- day 9 --------
name, sellIn, quality
+5 Dexterity Vest, 1, 11
Aged Brie, -7, 16
Elixir of the Mongoose, -4, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 6, 33
Backstage passes to a TAFKAL80ETC concert, 1, 50
Backstage passes to a TAFKAL80ETC concert, -4, 0
Conjured Mana Cake, -6, 0
-------- day 10 --------
name, sellIn, quality
+5 Dexterity Vest, 0, 10
Aged Brie, -8, 18
Elixir of the Mongoose, -5, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 5, 35
Backstage passes to a TAFKAL80ETC concert, 0, 50
Backstage passes to a TAFKAL80ETC concert, -5, 0
Conjured Mana Cake, -7, 0
-------- day 11 --------
name, sellIn, quality
+5 Dexterity Vest, -1, 8
Aged Brie, -9, 20
Elixir of the Mongoose, -6, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 4, 38
Backstage passes to a TAFKAL80ETC concert, -1, 0
Backstage passes to a TAFKAL80ETC concert, -6, 0
Conjured Mana Cake, -8, 0
-------- day 12 --------
name, sellIn, quality
+5 Dexterity Vest, -2, 6
Aged Brie, -10, 22
Elixir of the Mongoose, -7, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 3, 41
Backstage passes to a TAFKAL80ETC concert, -2, 0
Backstage passes to a TAFKAL80ETC concert, -7, 0
Conjured Mana Cake, -9, 0
-------- day 13 --------
name, sellIn, quality
+5 Dexterity Vest, -3, 4
Aged Brie, -11, 24
Elixir of the Mongoose, -8, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 2, 44
Backstage passes to a TAFKAL80ETC concert, -3, 0
Backstage passes to a TAFKAL80ETC concert, -8, 0
Conjured Mana Cake, -10, 0
-------- day 14 --------
name, sellIn, quality
+5 Dexterity Vest, -4, 2
Aged Brie, -12, 26
Elixir of the Mongoose, -9, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 1, 47
Backstage passes to a TAFKAL80ETC concert, -4, 0
Backstage passes to a TAFKAL80ETC concert, -9, 0
Conjured Mana Cake, -11, 0
-------- day 15 --------
name, sellIn, quality
+5 Dexterity Vest, -5, 0
Aged Brie, -13, 28
Elixir of the Mongoose, -10, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 0, 50
Backstage passes to a TAFKAL80ETC concert, -5, 0
Backstage passes to a TAFKAL80ETC concert, -10, 0
Conjured Mana Cake, -12, 0
-------- day 16 --------
name, sellIn, quality
+5 Dexterity Vest, -6, 0
Aged Brie, -14, 30
Elixir of the Mongoose, -11, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -1, 0
Backstage passes to a TAFKAL80ETC concert, -6, 0
Backstage passes to a TAFKAL80ETC concert, -11, 0
Conjured Mana Cake, -13, 0
-------- day 17 --------
name, sellIn, quality
+5 Dexterity Vest, -7, 0
Aged Brie, -15, 32
Elixir of the Mongoose, -12, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -2, 0
Backstage passes to a TAFKAL80ETC concert, -7, 0
Backstage passes to a TAFKAL80ETC concert, -12, 0
Conjured Mana Cake, -14, 0
-------- day 18 --------
name, sellIn, quality
+5 Dexterity Vest, -8, 0
Aged Brie, -16, 34
Elixir of the Mongoose, -13, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -3, 0
Backstage passes to a TAFKAL80ETC concert, -8, 0
Backstage passes to a TAFKAL80ETC concert, -13, 0
Conjured Mana Cake, -15, 0
-------- day 19 --------
name, sellIn, quality
+5 Dexterity Vest, -9, 0
Aged Brie, -17, 36
Elixir of the Mongoose, -14, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -4, 0
Backstage passes to a TAFKAL80ETC concert, -9, 0
Backstage passes to a TAFKAL80ETC concert, -14, 0
Conjured Mana Cake, -16, 0
-------- day 20 --------
name, sellIn, quality
+5 Dexterity Vest, -10, 0
Aged Brie, -18, 38
Elixir of the Mongoose, -15, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -5, 0
Backstage passes to a TAFKAL80ETC concert, -10, 0
Backstage passes to a TAFKAL80ETC concert, -15, 0
Conjured Mana Cake, -17, 0
-------- day 21 --------
name, sellIn, quality
+5 Dexterity Vest, -11, 0
Aged Brie, -19, 40
Elixir of the Mongoose, -16, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -6, 0
Backstage passes to a TAFKAL80ETC concert, -11, 0
Backstage passes to a TAFKAL80ETC concert, -16, 0
Conjured Mana Cake, -18, 0
-------- day 22 --------
name, sellIn, quality
+5 Dexterity Vest, -12, 0
Aged Brie, -20, 42
Elixir of the Mongoose, -17, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -7, 0
Backstage passes to a TAFKAL80ETC concert, -12, 0
Backstage passes to a TAFKAL80ETC concert, -17, 0
Conjured Mana Cake, -19, 0
-------- day 23 --------
name, sellIn, quality
+5 Dexterity Vest, -13, 0
Aged Brie, -21, 44
Elixir of the Mongoose, -18, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -8, 0
Backstage passes to a TAFKAL80ETC concert, -13, 0
Backstage passes to a TAFKAL80ETC concert, -18, 0
Conjured Mana Cake, -20, 0
-------- day 24 --------
name, sellIn, quality
+5 Dexterity Vest, -14, 0
Aged Brie, -22, 46
Elixir of the Mongoose, -19, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -9, 0
Backstage passes to a TAFKAL80ETC concert, -14, 0
Backstage passes to a TAFKAL80ETC concert, -19, 0
Conjured Mana Cake, -21, 0
-------- day 25 --------
name, sellIn, quality
+5 Dexterity Vest, -15, 0
Aged Brie, -23, 48
Elixir of the Mongoose, -20, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -10, 0
Backstage passes to a TAFKAL80ETC concert, -15, 0
Backstage passes to a TAFKAL80ETC concert, -20, 0
Conjured Mana Cake, -22, 0
-------- day 26 --------
name, sellIn, quality
+5 Dexterity Vest, -16, 0
Aged Brie, -24, 50
Elixir of the Mongoose, -21, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -11, 0
Backstage passes to a TAFKAL80ETC concert, -16, 0
Backstage passes to a TAFKAL80ETC concert, -21, 0
Conjured Mana Cake, -23, 0
-------- day 27 --------
name, sellIn, quality
+5 Dexterity Vest, -17, 0
Aged Brie, -25, 50
Elixir of the Mongoose, -22, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -12, 0
Backstage passes to a TAFKAL80ETC concert, -17, 0
Backstage passes to a TAFKAL80ETC concert, -22, 0
Conjured Mana Cake, -24, 0
-------- day 28 --------
name, sellIn, quality
+5 Dexterity Vest, -18, 0
Aged Brie, -26, 50
Elixir of the Mongoose, -23, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -13, 0
Backstage passes to a TAFKAL80ETC concert, -18, 0
Backstage passes to a TAFKAL80ETC concert, -23, 0
Conjured Mana Cake, -25, 0
-------- day 29 --------
name, sellIn, quality
+5 Dexterity Vest, -19, 0
Aged Brie, -27, 50
Elixir of the Mongoose, -24, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -14, 0
Backstage passes to a TAFKAL80ETC concert, -19, 0
Backstage passes to a TAFKAL80ETC concert, -24, 0
Conjured Mana Cake, -26, 0
-------- day 30 --------
name, sellIn, quality
+5 Dexterity Vest, -20, 0
Aged Brie, -28, 50
Elixir of the Mongoose, -25, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -15, 0
Backstage passes to a TAFKAL80ETC concert, -20, 0
Backstage passes to a TAFKAL80ETC concert, -25, 0
Conjured Mana Cake, -27, 0

View File

@ -1,35 +0,0 @@
full_name:Gilded Rose Refactoring Kata
# location where you have your clone
default_checkout:/Users/emily/training_materials/Refactoring-Katas/GildedRose
# Settings for the Java version
executable:com.gildedrose.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/texttest_fixture.py
#interpreter:python
# Settings for the C++ version
#executable:${TEXTTEST_CHECKOUT}/cpp/GildedRoseTextTests
# Settings for the Ruby version
#executable:${TEXTTEST_CHECKOUT}/ruby/texttest_fixture.rb
#interpreter:ruby
# Settings for the C# version
#executable:${TEXTTEST_CHECKOUT}/GildedRose.exe
# Settings for the Perl version
#executable:${TEXTTEST_CHECKOUT}/perl/texttest_fixture.pl
#interpreter:perl
# turn on one of these if you prefer them to notepad or emacs.
[view_program]
*:mate
#*:gedit
[end]
filename_convention_scheme:standard

View File

@ -1,3 +0,0 @@
# If your .class files are somewhere else, add the path to the list
CLASSPATH:${TEXTTEST_CHECKOUT}/Java:${TEXTTEST_CHECKOUT}/Java/bin
PERL5OPT:-I${TEXTTEST_CHECKOUT}/perl

View File

@ -1,2 +0,0 @@
# With one example of each special item, run for 30 days updating sellIn and quality.
ThirtyDays