Updae to scala 3

This commit is contained in:
adampridmore committed 2025-03-15 21:36:24 +00:00
1 parent dd26a2d3b6
commit 4af5375695
6 files changed
+41 -14

No files matched your search

@@ -3,7 +3,7 @@ package com.gildedrose
class GildedRose(val items: Array[Item]) {
def updateQuality() {
def updateQuality() : Unit = {
for (i <- 0 until items.length) {
if (!items(i).name.equals("Aged Brie")
&& !items(i).name.equals("Backstage passes to a TAFKAL80ETC concert")) {
@@ -55,4 +55,4 @@ class GildedRose(val items: Array[Item]) {
}
}
}
}
}
@@ -1,6 +1,6 @@
package com.gildedrose
object TexttestFixture {
object Main {
def main(args: Array[String]): Unit = {
val items = Array[Item](
new Item("+5 Dexterity Vest", 10, 20),
@@ -14,8 +14,13 @@ object TexttestFixture {
// 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
System.out.println("OMGHAI!")
for (i <- 0 until days) {
System.out.println("-------- day " + i + " --------")
System.out.println("name, sellIn, quality")
@@ -3,11 +3,11 @@ package com.gildedrose
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
class GildedRoseTest extends AnyFlatSpec with 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")
}
}
}