Basic Racket solution for the gilded rose kata.
- Racket, which you can get download here or, if you're on macOS, run
brew cask install racket.
raco test gilded-rose.rkt
> raco test: (submod "gilded-rose.rkt" test)
> 19 success(es) 0 failure(s) 0 error(s) 19 test(s) run
> 0
> 19 tests passedracket cli/main.rktThis will execute a 31-day cycle and print the output to stdout.
Alternatively you can run redirect the output to a file, actual.txt and compare it with expected.txt:
racket main.rkt > actual.txt
diff expected.txt actual.txtThe output should be something along the lines of:
1c1
< expected
---
> actual
24c24
< Conjured Mana Cake, 2, 5
---
> Conjured Mana Cake, 2, 4
36c36
< Conjured Mana Cake, 1, 4
---
> Conjured Mana Cake, 1, 2
48c48
< Conjured Mana Cake, 0, 3
---
> Conjured Mana Cake, 0, 0
60c60
< Conjured Mana Cake, -1, 1
---
> Conjured Mana Cake, -1, 0It's unclear to me if the TextTests are wrong: the way Conjured items devaluate in the test file seems to not respect the definition, i.e.
“Conjured” items degrade in Quality twice as fast as normal items
racket web/main.rktThis will start a web-server listening on port 8000, and launch the application in your default browser. It'll display a table containing your store's inventory, and a "next" button, which will update the current day.
