This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns gilded-rose.core-test | |
(:require [clojure.test :refer :all] | |
[gilded-rose.core :refer :all])) | |
(deftest gilded-rose-test | |
(testing "For all items except Sulfuras, sell in date decreases by one" | |
(let [not-sulfuras (item "not sulfuras" 20 30) | |
updated-sell-in 19] | |
(is (= updated-sell-in (:sell-in (first (update-quality [not-sulfuras]))))))) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns gilded-rose.core | |
(:gen-class)) | |
(defn update-quality [items] | |
(map | |
(fn[item] (cond | |
(and (< (:sell-in item) 0) (= "Backstage passes to a TAFKAL80ETC concert" (:name item))) | |
(merge item {:quality 0}) | |
(or (= (:name item) "Aged Brie") (= (:name item) "Backstage passes to a TAFKAL80ETC concert")) | |
(if (and (= (:name item) "Backstage passes to a TAFKAL80ETC concert") (>= (:sell-in item) 5) (< (:sell-in item) 10) (< (:quality item) 50)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Xunit; | |
namespace KataGildedRose.Tests | |
{ | |
public class GildedRoseTest | |
{ | |
private const string BackstageName = "Backstage passes to a TAFKAL80ETC concert"; | |
private const string NormalItemName = "foo"; | |
private const string AgedBrieName = "Aged Brie"; | |
private const string SulfurasName = "Sulfuras, Hand of Ragnaros"; |