-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #575 from lessless/main
Added text test fixture for Elixir
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
defmodule GildedRose.TextTestFixture do | ||
|
||
def run() do | ||
IO.puts("OMGHAI!") | ||
|
||
items = [ | ||
%Item{name: "+5 Dexterity Vest", sell_in: 10, quality: 20}, | ||
%Item{name: "Aged Brie", sell_in: 2, quality: 0}, | ||
%Item{name: "Elixir of the Mongoose", sell_in: 5, quality: 7}, | ||
%Item{name: "Sulfuras, Hand of Ragnaros", sell_in: 0, quality: 80}, | ||
%Item{name: "Sulfuras, Hand of Ragnaros", sell_in: -1, quality: 80}, | ||
%Item{name: "Backstage passes to a TAFKAL80ETC concert", sell_in: 15, quality: 20}, | ||
%Item{name: "Backstage passes to a TAFKAL80ETC concert", sell_in: 10, quality: 49}, | ||
%Item{name: "Backstage passes to a TAFKAL80ETC concert", sell_in: 5, quality: 49}, | ||
# This Conjured item does not work properly yet | ||
%Item{name: "Conjured Mana Cake", sell_in: 3, quality: 6}, # <-- :O | ||
] | ||
|
||
days = | ||
if System.get_env("DEFAULT_DAYS") != nil do | ||
"DEFAULT_DAYS" | ||
|> System.get_env() | ||
|> String.to_integer() | ||
else | ||
2 | ||
end | ||
|
||
Enum.reduce(0..days, items, fn day, items -> | ||
IO.puts "-------- day #{day} --------" | ||
IO.puts "name, sellIn, quality" | ||
Enum.each(items, fn item -> IO.inspect(item) end) | ||
IO.puts("") | ||
GildedRose.update_quality(items) | ||
end) | ||
end | ||
end |