mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-13 17:49:25 +00:00
updated tests and added README, based on review feedback.
This commit is contained in:
1 parent
42d6bce336
commit
4f43ddb78f
6 files changed
+76
-31
No files matched your search
@@ -1,10 +1,7 @@
|
||||
(import ../gilded-rose/main)
|
||||
(import ../src/main :as shop)
|
||||
(use judge)
|
||||
|
||||
(do
|
||||
(def items
|
||||
[@{ :name "foo" :quality 3 :sell-in 5}
|
||||
@{ :name "bar" :quality 6 :sell-in 6}])
|
||||
(main/update-quality items)
|
||||
(def found (find |(= ($ :quality) 2) items))
|
||||
(test (found :name) "fixme"))
|
||||
(def items [(shop/item "foo" 0 0)])
|
||||
(shop/update-quality items)
|
||||
(test ((first items) :name) "fixme"))
|
||||
@@ -0,0 +1,22 @@
|
||||
(import ../src/main :as shop)
|
||||
|
||||
(defn get-items []
|
||||
[ (shop/item "+5 Dexterity Vest" 20 10)
|
||||
(shop/item "Aged Brie" 0 2)
|
||||
(shop/item "Elixir of the Mongoose" 7 5)
|
||||
(shop/item "Sulfuras, Hand of Ragnaros" 80 0)
|
||||
(shop/item "Sulfuras, Hand of Ragnaros" 80 -1)
|
||||
(shop/item "Backstage passes to a TAFKAL80ETC concert" 20 15)
|
||||
(shop/item "Backstage passes to a TAFKAL80ETC concert" 49 10)
|
||||
(shop/item "Backstage passes to a TAFKAL80ETC concert" 49 5)
|
||||
(shop/item "Conjured Mana Cake" 6 3)])
|
||||
|
||||
# judge allows for snapshot testing of stdout, much like the texttest tool.
|
||||
# So something like the following would create a janet-native test of the output of shop/run:
|
||||
#
|
||||
# (test-stdout (shop/run 30 (get-items)))
|
||||
|
||||
(defn main [& args]
|
||||
(def num-days (scan-number (or (get args 1) "-1")))
|
||||
(def items (get-items))
|
||||
(shop/run num-days items))
|
||||
Reference in new issue
Block a user