From c9919d1a1b0d7331223f07271e18e63552f1da41 Mon Sep 17 00:00:00 2001 From: Ralf Comtesse Date: Mon, 15 Sep 2025 15:05:50 +0200 Subject: [PATCH] * converted Java TextestFixture to scala --- .../com/gildedrose/TexttestFixture.scala | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 scala/src/test/scala/com/gildedrose/TexttestFixture.scala diff --git a/scala/src/test/scala/com/gildedrose/TexttestFixture.scala b/scala/src/test/scala/com/gildedrose/TexttestFixture.scala new file mode 100644 index 00000000..fcfe471b --- /dev/null +++ b/scala/src/test/scala/com/gildedrose/TexttestFixture.scala @@ -0,0 +1,35 @@ +package com.gildedrose + +object TexttestFixture { + @main + def main(args: String*): Unit = { + println("OMGHAI!") + + val items = Array[Item]( + 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 = new GildedRose(items) + var days = 2 + + if (args.nonEmpty) days = args(0).toInt + 1 + + for (i <- 0 until days) { + println("-------- day " + i + " --------") + println("name, sellIn, quality") + for (item <- items) { + println(s"${item.name}, ${item.sellIn}, ${item.quality}") + } + println() + app.updateQuality() + } + } +}