mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-18 16:01:42 +00:00
Delete scala directory
This commit is contained in:
parent
e5defc28a2
commit
619ce68f35
19
scala/.gitignore
vendored
19
scala/.gitignore
vendored
@ -1,19 +0,0 @@
|
|||||||
/bin/
|
|
||||||
|
|
||||||
# OSX Finder
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
# IntelliJ
|
|
||||||
.idea
|
|
||||||
*.iml
|
|
||||||
|
|
||||||
# Eclipse
|
|
||||||
.worksheet
|
|
||||||
.settings
|
|
||||||
.cache
|
|
||||||
.cache-main
|
|
||||||
.cache-tests
|
|
||||||
.project
|
|
||||||
.classpath
|
|
||||||
|
|
||||||
target/
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
name := "GildedRose"
|
|
||||||
|
|
||||||
version := "1.0"
|
|
||||||
|
|
||||||
scalaVersion := "2.13.1"
|
|
||||||
|
|
||||||
resolvers += DefaultMavenRepository
|
|
||||||
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.1" % "test"
|
|
||||||
2
scala/project/.gitignore
vendored
2
scala/project/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
project/
|
|
||||||
target/
|
|
||||||
@ -1 +0,0 @@
|
|||||||
sbt.version=1.3.9
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
package com.gildedrose
|
|
||||||
|
|
||||||
class GildedRose(val items: Array[Item]) {
|
|
||||||
|
|
||||||
|
|
||||||
def updateQuality() {
|
|
||||||
for (i <- 0 until items.length) {
|
|
||||||
if (!items(i).name.equals("Aged Brie")
|
|
||||||
&& !items(i).name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
|
||||||
if (items(i).quality > 0) {
|
|
||||||
if (!items(i).name.equals("Sulfuras, Hand of Ragnaros")) {
|
|
||||||
items(i).quality = items(i).quality - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (items(i).quality < 50) {
|
|
||||||
items(i).quality = items(i).quality + 1
|
|
||||||
|
|
||||||
if (items(i).name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
|
||||||
if (items(i).sellIn < 11) {
|
|
||||||
if (items(i).quality < 50) {
|
|
||||||
items(i).quality = items(i).quality + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (items(i).sellIn < 6) {
|
|
||||||
if (items(i).quality < 50) {
|
|
||||||
items(i).quality = items(i).quality + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!items(i).name.equals("Sulfuras, Hand of Ragnaros")) {
|
|
||||||
items(i).sellIn = items(i).sellIn - 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if (items(i).sellIn < 0) {
|
|
||||||
if (!items(i).name.equals("Aged Brie")) {
|
|
||||||
if (!items(i).name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
|
||||||
if (items(i).quality > 0) {
|
|
||||||
if (!items(i).name.equals("Sulfuras, Hand of Ragnaros")) {
|
|
||||||
items(i).quality = items(i).quality - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
items(i).quality = items(i).quality - items(i).quality
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (items(i).quality < 50) {
|
|
||||||
items(i).quality = items(i).quality + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
package com.gildedrose
|
|
||||||
|
|
||||||
class Item(val name: String, var sellIn: Int, var quality: Int) {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
package com.gildedrose
|
|
||||||
|
|
||||||
import org.scalatest.flatspec.AnyFlatSpec
|
|
||||||
import org.scalatest.matchers.should.Matchers
|
|
||||||
|
|
||||||
class GildedRoseTest extends AnyFlatSpec with Matchers {
|
|
||||||
it should "foo" in {
|
|
||||||
val items = Array[Item](new Item("foo", 0, 0))
|
|
||||||
val app = new GildedRose(items)
|
|
||||||
app.updateQuality()
|
|
||||||
app.items(0).name should equal ("fixme")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
package com.gildedrose
|
|
||||||
|
|
||||||
object TexttestFixture {
|
|
||||||
def main(args: Array[String]): Unit = {
|
|
||||||
val 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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user