texttext fixture moved into own executable 'main' module.

This commit is contained in:
emily committed 2021-08-26 13:20:24 +02:00
1 parent 3db5265f46
commit 99906235bd
13 files changed
+62 -36

No files matched your search

-14
View File
@@ -1,14 +0,0 @@
{application, 'GildedRose',
[{description, "An OTP library"},
{vsn, "0.1.0"},
{registered, []},
{applications,
[kernel,
stdlib
]},
{env,[]},
{modules, []},
{licenses, ["Apache 2.0"]},
{links, []}
]}.
+1
View File
@@ -0,0 +1 @@
{application, gilded_rose, [{vsn, "0.1"}]}.
@@ -1,6 +1,6 @@
-module('GildedRose').
-module(gilded_rose).
-include("GildedRose.hrl").
-include("gilded_rose.hrl").
-export([
update_quality/1
+34
View File
@@ -0,0 +1,34 @@
-module(main).
-include("texttest_fixture.hrl").
-export([main/1]).
-define(ALL_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},
#item{name = "Conjured Mana Cake", sell_in = 3, quality = 6}
]).
main([Days]) ->
try
texttest_fixture:print_update_quality(Days, ?ALL_ITEMS)
catch
ExceptionClass:ExceptionInfo ->
io:format("something went wrong:~n~p : ~p~n", [ExceptionClass, ExceptionInfo]),
usage()
end;
main(_) ->
usage().
usage() ->
io:format("usage: main main number_of_days\ne.g. main main [30]\n"),
halt(1).
@@ -1,6 +1,6 @@
-module('TextTestFixture').
-module(texttest_fixture).
-include("GildedRose.hrl").
-include("texttest_fixture.hrl").
-export([print_update_quality/2]).
@@ -15,6 +15,7 @@ print_update_quality(Days, Items) ->
io:format("OMGHAI!"),
lists:foreach(
fun(Day) -> print_one_day(Day, Items),
'GildedRose':update_quality(Items)
end, lists:seq(0, Days - 1)).
gilded_rose:update_quality(Items)
end, lists:seq(0, Days - 1)
).