gilded rose in Ada

This commit is contained in:
Florian Franzmann 2018-11-09 16:47:32 +01:00 committed by Florian Franzmann
parent 3906ee2b8d
commit f4a171464f
12 changed files with 663 additions and 0 deletions

6
Ada/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
*.o
*.ali
b~*.ads
b~*.adb
program
gilded_rose_tester

23
Ada/Makefile Normal file
View File

@ -0,0 +1,23 @@
AHVEN_INCLUDE:=-aI/usr/share/ada/adainclude/ahven -aI/usr/include/ahven
AHVEN_LIBS:=-aO/usr/lib/x86_64-linux-gnu/ada/adalib/ahven -aO/usr/lib/ahven -aO/usr/lib -shared
ADAFLAGS:=-gnat2012 $(AHVEN_INCLUDE) $(AHVEN_LIBS)
LIBS:=-largs -lahven
.PHONY: all
all: gilded_rose_tester program
.PHONY: gilded_rose_tester
gilded_rose_tester:
@gnatmake -q $(ADAFLAGS) gilded_rose_tester $(LIBS)
.PHONY: test
test: gilded_rose_tester
@./gilded_rose_tester
.PHONY: program
program:
@gnatmake -q $(ADAFLAGS) program $(LIBS)
.PHONY: clean
clean:
@gnatclean -q gilded_rose_tester program

8
Ada/README Normal file
View File

@ -0,0 +1,8 @@
You will need the following programs:
- GNU make (on Debian-like systems do 'apt-get install make')
- gcc with Ada enabled ('apt-get install gnat')
- the ahven unit-test framework ('apt-get install libahven5-dev')
'make test' runs your tests once.

373
Ada/ThirtyDays.txt Normal file
View File

@ -0,0 +1,373 @@
OMGHAI!
-------- day 0 --------
name, sellIn, quality
+5 Dexterity Vest, 10, 20
Aged Brie, 2, 0
Elixir of the Mongoose, 5, 7
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 15, 20
Backstage passes to a TAFKAL80ETC concert, 10, 49
Backstage passes to a TAFKAL80ETC concert, 5, 49
Conjured Mana Cake, 3, 6
-------- day 1 --------
name, sellIn, quality
+5 Dexterity Vest, 9, 19
Aged Brie, 1, 1
Elixir of the Mongoose, 4, 6
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 14, 21
Backstage passes to a TAFKAL80ETC concert, 9, 50
Backstage passes to a TAFKAL80ETC concert, 4, 50
Conjured Mana Cake, 2, 5
-------- day 2 --------
name, sellIn, quality
+5 Dexterity Vest, 8, 18
Aged Brie, 0, 2
Elixir of the Mongoose, 3, 5
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 13, 22
Backstage passes to a TAFKAL80ETC concert, 8, 50
Backstage passes to a TAFKAL80ETC concert, 3, 50
Conjured Mana Cake, 1, 4
-------- day 3 --------
name, sellIn, quality
+5 Dexterity Vest, 7, 17
Aged Brie, -1, 4
Elixir of the Mongoose, 2, 4
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 12, 23
Backstage passes to a TAFKAL80ETC concert, 7, 50
Backstage passes to a TAFKAL80ETC concert, 2, 50
Conjured Mana Cake, 0, 3
-------- day 4 --------
name, sellIn, quality
+5 Dexterity Vest, 6, 16
Aged Brie, -2, 6
Elixir of the Mongoose, 1, 3
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 11, 24
Backstage passes to a TAFKAL80ETC concert, 6, 50
Backstage passes to a TAFKAL80ETC concert, 1, 50
Conjured Mana Cake, -1, 1
-------- day 5 --------
name, sellIn, quality
+5 Dexterity Vest, 5, 15
Aged Brie, -3, 8
Elixir of the Mongoose, 0, 2
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 10, 25
Backstage passes to a TAFKAL80ETC concert, 5, 50
Backstage passes to a TAFKAL80ETC concert, 0, 50
Conjured Mana Cake, -2, 0
-------- day 6 --------
name, sellIn, quality
+5 Dexterity Vest, 4, 14
Aged Brie, -4, 10
Elixir of the Mongoose, -1, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 9, 27
Backstage passes to a TAFKAL80ETC concert, 4, 50
Backstage passes to a TAFKAL80ETC concert, -1, 0
Conjured Mana Cake, -3, 0
-------- day 7 --------
name, sellIn, quality
+5 Dexterity Vest, 3, 13
Aged Brie, -5, 12
Elixir of the Mongoose, -2, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 8, 29
Backstage passes to a TAFKAL80ETC concert, 3, 50
Backstage passes to a TAFKAL80ETC concert, -2, 0
Conjured Mana Cake, -4, 0
-------- day 8 --------
name, sellIn, quality
+5 Dexterity Vest, 2, 12
Aged Brie, -6, 14
Elixir of the Mongoose, -3, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 7, 31
Backstage passes to a TAFKAL80ETC concert, 2, 50
Backstage passes to a TAFKAL80ETC concert, -3, 0
Conjured Mana Cake, -5, 0
-------- day 9 --------
name, sellIn, quality
+5 Dexterity Vest, 1, 11
Aged Brie, -7, 16
Elixir of the Mongoose, -4, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 6, 33
Backstage passes to a TAFKAL80ETC concert, 1, 50
Backstage passes to a TAFKAL80ETC concert, -4, 0
Conjured Mana Cake, -6, 0
-------- day 10 --------
name, sellIn, quality
+5 Dexterity Vest, 0, 10
Aged Brie, -8, 18
Elixir of the Mongoose, -5, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 5, 35
Backstage passes to a TAFKAL80ETC concert, 0, 50
Backstage passes to a TAFKAL80ETC concert, -5, 0
Conjured Mana Cake, -7, 0
-------- day 11 --------
name, sellIn, quality
+5 Dexterity Vest, -1, 8
Aged Brie, -9, 20
Elixir of the Mongoose, -6, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 4, 38
Backstage passes to a TAFKAL80ETC concert, -1, 0
Backstage passes to a TAFKAL80ETC concert, -6, 0
Conjured Mana Cake, -8, 0
-------- day 12 --------
name, sellIn, quality
+5 Dexterity Vest, -2, 6
Aged Brie, -10, 22
Elixir of the Mongoose, -7, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 3, 41
Backstage passes to a TAFKAL80ETC concert, -2, 0
Backstage passes to a TAFKAL80ETC concert, -7, 0
Conjured Mana Cake, -9, 0
-------- day 13 --------
name, sellIn, quality
+5 Dexterity Vest, -3, 4
Aged Brie, -11, 24
Elixir of the Mongoose, -8, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 2, 44
Backstage passes to a TAFKAL80ETC concert, -3, 0
Backstage passes to a TAFKAL80ETC concert, -8, 0
Conjured Mana Cake, -10, 0
-------- day 14 --------
name, sellIn, quality
+5 Dexterity Vest, -4, 2
Aged Brie, -12, 26
Elixir of the Mongoose, -9, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 1, 47
Backstage passes to a TAFKAL80ETC concert, -4, 0
Backstage passes to a TAFKAL80ETC concert, -9, 0
Conjured Mana Cake, -11, 0
-------- day 15 --------
name, sellIn, quality
+5 Dexterity Vest, -5, 0
Aged Brie, -13, 28
Elixir of the Mongoose, -10, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 0, 50
Backstage passes to a TAFKAL80ETC concert, -5, 0
Backstage passes to a TAFKAL80ETC concert, -10, 0
Conjured Mana Cake, -12, 0
-------- day 16 --------
name, sellIn, quality
+5 Dexterity Vest, -6, 0
Aged Brie, -14, 30
Elixir of the Mongoose, -11, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -1, 0
Backstage passes to a TAFKAL80ETC concert, -6, 0
Backstage passes to a TAFKAL80ETC concert, -11, 0
Conjured Mana Cake, -13, 0
-------- day 17 --------
name, sellIn, quality
+5 Dexterity Vest, -7, 0
Aged Brie, -15, 32
Elixir of the Mongoose, -12, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -2, 0
Backstage passes to a TAFKAL80ETC concert, -7, 0
Backstage passes to a TAFKAL80ETC concert, -12, 0
Conjured Mana Cake, -14, 0
-------- day 18 --------
name, sellIn, quality
+5 Dexterity Vest, -8, 0
Aged Brie, -16, 34
Elixir of the Mongoose, -13, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -3, 0
Backstage passes to a TAFKAL80ETC concert, -8, 0
Backstage passes to a TAFKAL80ETC concert, -13, 0
Conjured Mana Cake, -15, 0
-------- day 19 --------
name, sellIn, quality
+5 Dexterity Vest, -9, 0
Aged Brie, -17, 36
Elixir of the Mongoose, -14, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -4, 0
Backstage passes to a TAFKAL80ETC concert, -9, 0
Backstage passes to a TAFKAL80ETC concert, -14, 0
Conjured Mana Cake, -16, 0
-------- day 20 --------
name, sellIn, quality
+5 Dexterity Vest, -10, 0
Aged Brie, -18, 38
Elixir of the Mongoose, -15, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -5, 0
Backstage passes to a TAFKAL80ETC concert, -10, 0
Backstage passes to a TAFKAL80ETC concert, -15, 0
Conjured Mana Cake, -17, 0
-------- day 21 --------
name, sellIn, quality
+5 Dexterity Vest, -11, 0
Aged Brie, -19, 40
Elixir of the Mongoose, -16, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -6, 0
Backstage passes to a TAFKAL80ETC concert, -11, 0
Backstage passes to a TAFKAL80ETC concert, -16, 0
Conjured Mana Cake, -18, 0
-------- day 22 --------
name, sellIn, quality
+5 Dexterity Vest, -12, 0
Aged Brie, -20, 42
Elixir of the Mongoose, -17, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -7, 0
Backstage passes to a TAFKAL80ETC concert, -12, 0
Backstage passes to a TAFKAL80ETC concert, -17, 0
Conjured Mana Cake, -19, 0
-------- day 23 --------
name, sellIn, quality
+5 Dexterity Vest, -13, 0
Aged Brie, -21, 44
Elixir of the Mongoose, -18, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -8, 0
Backstage passes to a TAFKAL80ETC concert, -13, 0
Backstage passes to a TAFKAL80ETC concert, -18, 0
Conjured Mana Cake, -20, 0
-------- day 24 --------
name, sellIn, quality
+5 Dexterity Vest, -14, 0
Aged Brie, -22, 46
Elixir of the Mongoose, -19, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -9, 0
Backstage passes to a TAFKAL80ETC concert, -14, 0
Backstage passes to a TAFKAL80ETC concert, -19, 0
Conjured Mana Cake, -21, 0
-------- day 25 --------
name, sellIn, quality
+5 Dexterity Vest, -15, 0
Aged Brie, -23, 48
Elixir of the Mongoose, -20, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -10, 0
Backstage passes to a TAFKAL80ETC concert, -15, 0
Backstage passes to a TAFKAL80ETC concert, -20, 0
Conjured Mana Cake, -22, 0
-------- day 26 --------
name, sellIn, quality
+5 Dexterity Vest, -16, 0
Aged Brie, -24, 50
Elixir of the Mongoose, -21, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -11, 0
Backstage passes to a TAFKAL80ETC concert, -16, 0
Backstage passes to a TAFKAL80ETC concert, -21, 0
Conjured Mana Cake, -23, 0
-------- day 27 --------
name, sellIn, quality
+5 Dexterity Vest, -17, 0
Aged Brie, -25, 50
Elixir of the Mongoose, -22, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -12, 0
Backstage passes to a TAFKAL80ETC concert, -17, 0
Backstage passes to a TAFKAL80ETC concert, -22, 0
Conjured Mana Cake, -24, 0
-------- day 28 --------
name, sellIn, quality
+5 Dexterity Vest, -18, 0
Aged Brie, -26, 50
Elixir of the Mongoose, -23, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -13, 0
Backstage passes to a TAFKAL80ETC concert, -18, 0
Backstage passes to a TAFKAL80ETC concert, -23, 0
Conjured Mana Cake, -25, 0
-------- day 29 --------
name, sellIn, quality
+5 Dexterity Vest, -19, 0
Aged Brie, -27, 50
Elixir of the Mongoose, -24, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -14, 0
Backstage passes to a TAFKAL80ETC concert, -19, 0
Backstage passes to a TAFKAL80ETC concert, -24, 0
Conjured Mana Cake, -26, 0
-------- day 30 --------
name, sellIn, quality
+5 Dexterity Vest, -20, 0
Aged Brie, -28, 50
Elixir of the Mongoose, -25, 0
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, -15, 0
Backstage passes to a TAFKAL80ETC concert, -20, 0
Backstage passes to a TAFKAL80ETC concert, -25, 0
Conjured Mana Cake, -27, 0

62
Ada/gilded_rose.adb Normal file
View File

@ -0,0 +1,62 @@
with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;
package body Gilded_Rose is
procedure Update_Quality(Self : in out Gilded_Rose) is
Cursor : Item_Vecs.Cursor := Item_Vecs.First(Self.Items);
begin
while Item_Vecs.Has_Element(Cursor) loop
if Self.Items(Cursor).Name /= To_Unbounded_String("Aged Brie")
and Self.Items(Cursor).Name /= To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert") then
if Self.Items(Cursor).Quality > 0 then
if Self.Items(Cursor).Name /= To_Unbounded_String("Sulfuras, Hand of Ragnaros") then
Self.Items(Cursor).Quality := Self.Items(Cursor).Quality - 1;
end if;
end if;
else
if Self.Items(Cursor).Quality < 50 then
Self.Items(Cursor).Quality := Self.Items(Cursor).Quality + 1;
if Self.Items(Cursor).Name = To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert") then
if Self.Items(Cursor).Sell_In < 11 then
if Self.Items(Cursor).Quality < 50 then
Self.Items(Cursor).Quality := Self.Items(Cursor).Quality + 1;
end if;
end if;
if Self.Items(Cursor).Sell_In < 6 then
if Self.Items(Cursor).Quality < 50 then
Self.Items(Cursor).Quality := Self.Items(Cursor).Quality + 1;
end if;
end if;
end if;
end if;
end if;
if Self.Items(Cursor).Name /= To_Unbounded_String("Sulfuras, Hand of Ragnaros") then
Self.Items(Cursor).Sell_In := Self.Items(Cursor).Sell_In - 1;
end if;
if Self.Items(Cursor).Sell_In < 0 then
if Self.Items(Cursor).Name /= To_Unbounded_String("Aged Brie") then
if Self.Items(Cursor).Name /= To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert") then
if Self.Items(Cursor).Quality > 0 then
if Self.Items(Cursor).Name /= To_Unbounded_String("Sulfuras, Hand of Ragnaros") then
Self.Items(Cursor).Quality := Self.Items(Cursor).Quality - 1;
end if;
end if;
else
Self.Items(Cursor).Quality := Self.Items(Cursor).Quality - Self.Items(Cursor).Quality;
end if;
else
if Self.Items(Cursor).Quality < 50 then
Self.Items(Cursor).Quality := Self.Items(Cursor).Quality + 1;
end if;
end if;
end if;
Item_Vecs.Next(Cursor);
end loop;
end;
end Gilded_Rose;

15
Ada/gilded_rose.ads Normal file
View File

@ -0,0 +1,15 @@
with Ada.Containers.Vectors;
with Items;
use Items;
package Gilded_Rose is
package Item_Vecs is new Ada.Containers.Vectors (
Element_Type => Item,
Index_Type => Positive
);
type Gilded_Rose is record
Items : Item_Vecs.Vector;
end record;
procedure Update_Quality(Self : in out Gilded_Rose);
end Gilded_Rose;

View File

@ -0,0 +1,10 @@
with Ahven.Text_Runner;
with Ahven.Framework;
with Gilded_Rose_Tests;
procedure Gilded_Rose_Tester is
S : Ahven.Framework.Test_Suite := Ahven.Framework.Create_Suite("All");
begin
Ahven.Framework.Add_Test(S, new Gilded_Rose_Tests.Test);
Ahven.Text_Runner.Run(S);
end Gilded_Rose_Tester;

38
Ada/gilded_rose_tests.adb Normal file
View File

@ -0,0 +1,38 @@
with Gilded_Rose;
use Gilded_Rose;
with Items;
use Items;
with Ahven;
with Ada.Strings.Unbounded;
package body Gilded_Rose_Tests is
procedure Initialize(T : in out Test) is
begin
Set_Name(T, "Gilded_Rose_Test");
Ahven.Framework.Add_Test_Routine(T, Test_Gilded_Rose'Access, "Foo");
end Initialize;
procedure Test_Gilded_Rose is
Things : Item_Vecs.Vector;
begin
Things.Append(New_Item =>
(Name => SU.To_Unbounded_String("Foo"),
Sell_In => 0,
Quality => 0));
declare
App : Gilded_Rose.Gilded_Rose := (Items => Things);
package SU renames Ada.Strings.Unbounded;
procedure Assert_Eq_Unbounded_String is
new Ahven.Assert_Equal(Data_Type => SU.Unbounded_String, Image => SU.To_String);
begin
Update_Quality(App);
Assert_Eq_Unbounded_String(Actual => App.Items(Item_Vecs.First(App.Items)).Name,
Expected => SU.To_Unbounded_String("fixme"),
Message => "fixme");
end;
end;
end Gilded_Rose_Tests;

11
Ada/gilded_rose_tests.ads Normal file
View File

@ -0,0 +1,11 @@
with Ahven.Framework;
package Gilded_Rose_Tests is
type Test is new Ahven.Framework.Test_Case with null record;
procedure Initialize(T : in out Test);
private
procedure Test_Gilded_Rose;
end Gilded_Rose_Tests;

31
Ada/items.adb Normal file
View File

@ -0,0 +1,31 @@
with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;
package body Items is
function Integer_Image(Self : in Integer) return String is
Img : constant String := Integer'Image(Self);
begin
if Self < 0 then
return Img;
else
return Img(2 .. Img'Length);
end if;
end;
function To_String(Self : in Item) return String is
Name : constant Unbounded_String := Self.Name;
Sell_In : constant Unbounded_String := To_Unbounded_String(Integer_Image(Self.Sell_In));
Quality : constant Unbounded_String := To_Unbounded_String(Integer_Image(Self.Quality));
Ret : Unbounded_String;
begin
Append(Ret, Name);
Append(Ret, ", ");
Append(Ret, Sell_In);
Append(Ret, ", ");
Append(Ret, Quality);
return To_String(Ret);
end;
end Items;

14
Ada/items.ads Normal file
View File

@ -0,0 +1,14 @@
with Ada.Strings.Unbounded;
package Items is
package SU renames Ada.Strings.Unbounded;
type Item is record
Name : SU.Unbounded_String;
Sell_In : Integer;
Quality : Integer;
end record;
function To_String(Self : in Item) return String;
end Items;

72
Ada/program.adb Normal file
View File

@ -0,0 +1,72 @@
with Ada.Text_IO;
use Ada.Text_IO;
with Items;
use Items;
with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;
with Gilded_Rose;
use Gilded_Rose;
procedure Program is
Things : Item_Vecs.Vector;
begin
Things.Append(New_Item =>
(Name => To_Unbounded_String("+5 Dexterity Vest"),
Sell_In => 10,
Quality => 20));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Aged Brie"),
Sell_In => 2,
Quality => 0));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Elixir of the Mongoose"),
Sell_In => 5,
Quality => 7));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Sulfuras, Hand of Ragnaros"),
Sell_In => 0,
Quality => 80));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Sulfuras, Hand of Ragnaros"),
Sell_In => -1,
Quality => 80));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert"),
Sell_In => 15,
Quality => 20));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert"),
Sell_In => 10,
Quality => 49));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert"),
Sell_In => 5,
Quality => 49));
-- this conjured item does not work properly yet
Things.Append(New_Item =>
(Name => To_Unbounded_String("Conjured Mana Cake"),
Sell_In => 3,
Quality => 6));
declare
App : Gilded_Rose.Gilded_Rose := (Items => Things);
begin
Put_Line("OMGHAI!");
for I in 0 .. 30 loop
Put_Line("-------- day" & Integer'Image(I) & " --------");
Put_Line("name, sellIn, quality");
for Each of App.Items loop
Put_Line(To_String(Each));
end loop;
Put_Line("");
Update_Quality(App);
end loop;
end;
end;