mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-23 02:11:10 +00:00
removed unused languages
This commit is contained in:
parent
fbe24e35b5
commit
aa20f223ed
6
Ada/.gitignore
vendored
6
Ada/.gitignore
vendored
@ -1,6 +0,0 @@
|
||||
*.o
|
||||
*.ali
|
||||
b~*.ads
|
||||
b~*.adb
|
||||
program
|
||||
gilded_rose_tester
|
||||
23
Ada/Makefile
23
Ada/Makefile
@ -1,23 +0,0 @@
|
||||
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
|
||||
@ -1,8 +0,0 @@
|
||||
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.
|
||||
|
||||
@ -1,373 +0,0 @@
|
||||
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
|
||||
|
||||
@ -1,62 +0,0 @@
|
||||
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;
|
||||
@ -1,15 +0,0 @@
|
||||
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;
|
||||
@ -1,10 +0,0 @@
|
||||
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;
|
||||
@ -1,38 +0,0 @@
|
||||
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;
|
||||
@ -1,11 +0,0 @@
|
||||
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;
|
||||
@ -1,31 +0,0 @@
|
||||
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;
|
||||
@ -1,14 +0,0 @@
|
||||
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;
|
||||
@ -1,72 +0,0 @@
|
||||
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;
|
||||
@ -1,90 +0,0 @@
|
||||
#include <string.h>
|
||||
#include "GildedRose.h"
|
||||
|
||||
Item*
|
||||
init_item(Item* item, const char *name, int sellIn, int quality)
|
||||
{
|
||||
item->sellIn = sellIn;
|
||||
item->quality = quality;
|
||||
item->name = strdup(name);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
void update_quality(Item items[], int size)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
if (strcmp(items[i].name, "Aged Brie") && strcmp(items[i].name, "Backstage passes to a TAFKAL80ETC concert"))
|
||||
{
|
||||
if (items[i].quality > 0)
|
||||
{
|
||||
if (strcmp(items[i].name, "Sulfuras, Hand of Ragnaros"))
|
||||
{
|
||||
items[i].quality = items[i].quality - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
|
||||
if (!strcmp(items[i].name, "Backstage passes to a TAFKAL80ETC concert"))
|
||||
{
|
||||
if (items[i].sellIn < 11)
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (items[i].sellIn < 6)
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(items[i].name, "Sulfuras, Hand of Ragnaros"))
|
||||
{
|
||||
items[i].sellIn = items[i].sellIn - 1;
|
||||
}
|
||||
|
||||
if (items[i].sellIn < 0)
|
||||
{
|
||||
if (strcmp(items[i].name, "Aged Brie"))
|
||||
{
|
||||
if (strcmp(items[i].name, "Backstage passes to a TAFKAL80ETC concert"))
|
||||
{
|
||||
if (items[i].quality > 0)
|
||||
{
|
||||
if (strcmp(items[i].name, "Sulfuras, Hand of Ragnaros"))
|
||||
{
|
||||
items[i].quality = items[i].quality - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
items[i].quality = items[i].quality - items[i].quality;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
int sellIn;
|
||||
int quality;
|
||||
} Item;
|
||||
|
||||
extern Item* init_item(Item* item, const char *name, int sellIn, int quality);
|
||||
extern void update_quality(Item items[], int size);
|
||||
@ -1,43 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include "GildedRose.h"
|
||||
|
||||
int
|
||||
print_item(Item *item)
|
||||
{
|
||||
return printf("%s, %d, %d\n", item->name, item->sellIn, item->quality);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
Item items[9];
|
||||
int last = 0;
|
||||
int day;
|
||||
int index;
|
||||
|
||||
init_item(items + last++, "+5 Dexterity Vest", 10, 20);
|
||||
init_item(items + last++, "Aged Brie", 2, 0);
|
||||
init_item(items + last++, "Elixir of the Mongoose", 5, 7);
|
||||
init_item(items + last++, "Sulfuras, Hand of Ragnaros", 0, 80);
|
||||
init_item(items + last++, "Sulfuras, Hand of Ragnaros", -1, 80);
|
||||
init_item(items + last++, "Backstage passes to a TAFKAL80ETC concert", 15, 20);
|
||||
init_item(items + last++, "Backstage passes to a TAFKAL80ETC concert", 10, 49);
|
||||
init_item(items + last++, "Backstage passes to a TAFKAL80ETC concert", 5, 49);
|
||||
// this Conjured item doesn't yet work properly
|
||||
init_item(items + last++, "Conjured Mana Cake", 3, 6);
|
||||
|
||||
puts("OMGHAI!");
|
||||
|
||||
for (day = 0; day <= 30; day++)
|
||||
{
|
||||
printf("-------- day %d --------\n", day);
|
||||
printf("name, sellIn, quality\n");
|
||||
for(index = 0; index < last; index++) {
|
||||
print_item(items + index);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
update_quality(items, last);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
#include <CppUTest/TestHarness.h>
|
||||
#include <CppUTest/CommandLineTestRunner.h>
|
||||
#include <CppUTestExt/MockSupport.h>
|
||||
|
||||
extern "C" {
|
||||
#include "GildedRose.h"
|
||||
}
|
||||
|
||||
TEST_GROUP(TestGildedRoseGroup)
|
||||
{
|
||||
void setup() {
|
||||
}
|
||||
void teardown() {
|
||||
}
|
||||
};
|
||||
|
||||
TEST(TestGildedRoseGroup, FirstTest)
|
||||
{
|
||||
Item items[2];
|
||||
init_item(items, "Foo", 0, 0);
|
||||
update_quality(items, 1);
|
||||
STRCMP_EQUAL("fixme", items[0].name);
|
||||
}
|
||||
|
||||
void example()
|
||||
{
|
||||
Item items[6];
|
||||
int last = 0;
|
||||
|
||||
init_item(items + last++, "+5 Dexterity Vest", 10, 20);
|
||||
init_item(items + last++, "Aged Brie", 2, 0);
|
||||
init_item(items + last++, "Elixir of the Mongoose", 5, 7);
|
||||
init_item(items + last++, "Sulfuras, Hand of Ragnaros", 0, 80);
|
||||
init_item(items + last++, "Backstage passes to a TAFKAL80ETC concert", 15, 20);
|
||||
init_item(items + last++, "Conjured Mana Cake", 3, 6);
|
||||
update_quality(items, last);
|
||||
}
|
||||
|
||||
int
|
||||
main(int ac, char** av)
|
||||
{
|
||||
return CommandLineTestRunner::RunAllTests(ac, av);
|
||||
}
|
||||
51
C/Makefile
51
C/Makefile
@ -1,51 +0,0 @@
|
||||
# Makefile for building the kata file with the Google Testing Framework
|
||||
#
|
||||
# SYNOPSIS:
|
||||
#
|
||||
# make [all] - makes everything.
|
||||
# make TARGET - makes the given target.
|
||||
# make clean - removes all files generated by make.
|
||||
|
||||
# Please tweak the following variable definitions as needed by your
|
||||
# project.
|
||||
|
||||
# Points to the root of CppUTest, relative to where this file is.
|
||||
# Remember to tweak this if you move this file.
|
||||
CPPUTEST_HOME = CppUTest
|
||||
|
||||
# Where to find user code.
|
||||
USER_DIR = .
|
||||
|
||||
# Flags passed to the preprocessor.
|
||||
CPPFLAGS += -I$(CPPUTEST_HOME)/include
|
||||
|
||||
# Flags passed to the C++ compiler.
|
||||
CFLAGS += -g -Wall -Wextra
|
||||
|
||||
LD_LIBRARIES = -L$(CPPUTEST_HOME)/lib -lCppUTest
|
||||
|
||||
# All tests produced by this Makefile. Remember to add new tests you
|
||||
# created to the list.
|
||||
TESTS = GildedRoseUnitTests
|
||||
|
||||
TEXTTESTS = GildedRoseTextTests
|
||||
|
||||
# House-keeping build targets.
|
||||
|
||||
all : $(TESTS) $(TEXTTESTS)
|
||||
|
||||
GildedRose.o : $(USER_DIR)/GildedRose.c
|
||||
|
||||
GildedRoseUnitTests : $(USER_DIR)/GildedRoseUnitTests.cc GildedRose.o
|
||||
$(CXX) $(CPPFLAGS) $(CFLAGS) -o $@ $(USER_DIR)/GildedRoseUnitTests.cc GildedRose.o $(LD_LIBRARIES)
|
||||
|
||||
GildedRoseTextTests.o : $(USER_DIR)/GildedRoseTextTests.c
|
||||
|
||||
GildedRoseTextTests : GildedRoseTextTests.o GildedRose.o
|
||||
$(CC) $^ -o $@
|
||||
|
||||
clean :
|
||||
rm -f $(TESTS) $(TEXTTESTS) *.o *~
|
||||
|
||||
check-syntax:
|
||||
gcc $(CPPFLAGS) -o /dev/null -S ${CHK_SOURCES}
|
||||
@ -1,5 +0,0 @@
|
||||
run-once.sh runs your tests once
|
||||
|
||||
Assumptions:
|
||||
- make and a C++ compiler (like gcc) is installed on your system and is in the PATH
|
||||
- The CppUTest framework is in the directory CppUTest
|
||||
@ -1,2 +0,0 @@
|
||||
make
|
||||
./GildedRoseTextTests
|
||||
@ -1,169 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="cobolProject" name="Gilded Rose" uuid="3529a385-3bb5-4b82-9b84-9e384fb2bdd4" version="4.0">
|
||||
<settings xsi:type="projectSettingsContainer">
|
||||
<copybook-paths xsi:type="copybookPathsSettings">
|
||||
<path enabled="true" name="/Gilded Rose" type="mfpath"/>
|
||||
</copybook-paths>
|
||||
<build-precedence-paths xsi:type="buildPrecedenceSettings">
|
||||
<path enabled="true" name="/Gilded Rose" type="mfpath"/>
|
||||
</build-precedence-paths>
|
||||
<configurations default="Gilded Rose" linkedWith="2017" xsi:type="buildConfigurationsContainer">
|
||||
<configuration description="Gilded Rose" type="all_intgnt" is64bit="false" createlbr="false" platform="Windows" xsi:type="cobolBuildConfiguration">
|
||||
<targetdir name="Gilded Rose.bin"/>
|
||||
<application_configuration xsi:type="runtimeConfigurationSettings">
|
||||
<cobol_switches xsi:type="projectCobolSwitches"/>
|
||||
<rts_switches xsi:type="projectRtsSwitches"/>
|
||||
<envScriptParameters></envScriptParameters>
|
||||
<envScriptPath></envScriptPath>
|
||||
<inheritBuildEnv>false</inheritBuildEnv>
|
||||
<tunables>
|
||||
<tunable index="0" name="screen_lines" value="25"/>
|
||||
<tunable index="0" name="screen_cols" value="80"/>
|
||||
<tunable index="0" name="default_cancel_mode" value="1"/>
|
||||
<tunable index="0" name="program_search_order" value="4"/>
|
||||
<tunable index="0" name="arguments_are_initial" value="false"/>
|
||||
<tunable index="0" name="command_line_accept" value="false"/>
|
||||
<tunable index="0" name="sort_memory" value="0"/>
|
||||
<tunable index="0" name="dynamic_memory_limit" value="2147483647"/>
|
||||
<tunable index="0" name="memory_free_check_size" value="100"/>
|
||||
<tunable index="0" name="memory_strategy" value="1"/>
|
||||
<tunable index="0" name="ansi_input_mode" value="false"/>
|
||||
<tunable index="0" name="current_year" value="0"/>
|
||||
<tunable index="0" name="current_month" value="0"/>
|
||||
<tunable index="0" name="current_day" value="0"/>
|
||||
<tunable index="0" name="datewarp_dynamic" value="false"/>
|
||||
<tunable index="0" name="current_hour" value="-1"/>
|
||||
<tunable index="0" name="current_minute" value="-1"/>
|
||||
<tunable index="0" name="current_second" value="-1"/>
|
||||
<tunable index="0" name="timewarp_dynamic" value="false"/>
|
||||
</tunables>
|
||||
</application_configuration>
|
||||
<link_settings xsi:type="linkSettings">
|
||||
<additional_options value=""/>
|
||||
<rts_bind value="false"/>
|
||||
<custom_link_command value=""/>
|
||||
<debug value="false"/>
|
||||
<entry_point name=""/>
|
||||
<entry_point_runtime value="false"/>
|
||||
<error_undefined_syms value="false"/>
|
||||
<application_type value="console"/>
|
||||
<include_cpp value="false"/>
|
||||
<additional_files/>
|
||||
<rcfile path=""/>
|
||||
<rts_type value="shared"/>
|
||||
<target name="Gilded Rose"/>
|
||||
<targettype type="exe"/>
|
||||
<threaded_rts value="true"/>
|
||||
<verbose value="false"/>
|
||||
</link_settings>
|
||||
</configuration>
|
||||
</configurations>
|
||||
<cobol_settings xsi:type="cobolSettings">
|
||||
<options>
|
||||
<option name="WARNING" value="1"/>
|
||||
<option name="DIALECT" value="MF"/>
|
||||
<option name="CHARSET" value="ASCII"/>
|
||||
<option name="SOURCEFORMAT" value="free"/>
|
||||
<option name="MAX-ERROR" value="100"/>
|
||||
</options>
|
||||
<createJar value="false"/>
|
||||
<createJarAfterBuild value="false"/>
|
||||
<debug value="true"/>
|
||||
<enableCodeCoverage value="true"/>
|
||||
<enableProfiler value="false"/>
|
||||
<generate value="false"/>
|
||||
<retainDirectivesFile value="false"/>
|
||||
<genListFile value="false"/>
|
||||
<packageToFolderMapping value="false"/>
|
||||
<useJvmDynamicCalls value="false"/>
|
||||
<useJvmIncrementalBuild value="false"/>
|
||||
<verbose value="false"/>
|
||||
</cobol_settings>
|
||||
<ims_settings xsi:type="additionalImsSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
<generatedFileDir name=""/>
|
||||
<imsDatabaseDir name=""/>
|
||||
</ims_settings>
|
||||
<mfs_settings xsi:type="mfsSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/MFS/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
</mfs_settings>
|
||||
<dbd_settings xsi:type="dbdSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/DBD/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
<cleanDbdOutputFiles value="false"/>
|
||||
</dbd_settings>
|
||||
<psb_settings xsi:type="psbSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/PSB/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
<cleanPsbOutputFiles value="false"/>
|
||||
</psb_settings>
|
||||
<bms_settings xsi:type="bmsSettings">
|
||||
<options>
|
||||
<option id="dsect" name="bmsSettings" value="/SYSPARM=DSECT"/>
|
||||
<option id="decimalchar" name="bmsSettings" value="/DP=."/>
|
||||
<option id="currencychar" name="bmsSettings" value="/CS=$"/>
|
||||
<option id="sdf" name="bmsSettings" value="/IGNORE"/>
|
||||
<option id="map" name="bmsSettings" value="/SYSPARM=MAP"/>
|
||||
</options>
|
||||
</bms_settings>
|
||||
<dependent-projects xsi:type="dependentProjectsSettings"/>
|
||||
<asm_settings xsi:type="assemblerCompileSettings">
|
||||
<options>
|
||||
<option id="compile_pre_assm_macros" name="mf370chk" value="NOMPC"/>
|
||||
<option id="compile_mark_reentrant" name="mf370chk" value="RENT"/>
|
||||
<option id="compile_create_optimized_code" name="mf370chk" value="NOOPT"/>
|
||||
<option id="compile_aat_info" name="mf370chk" value="NOAAT"/>
|
||||
<option id="compile_cross_ref_listing" name="mf370chk" value="NOXREF"/>
|
||||
<option id="compile_create_debug_info" name="mf370chk" value="ANIM"/>
|
||||
<option id="compile_generate_listing" name="mf370chk" value="NOLIST"/>
|
||||
</options>
|
||||
</asm_settings>
|
||||
<asm_link_settings xsi:type="assemblerLinkSettings">
|
||||
<options>
|
||||
<option id="link_residency_mode" name="mf370lnk" value="RMODE(31)"/>
|
||||
<option id="link_linker_output" name="mf370lnk" value="OMF(390)"/>
|
||||
<option id="link_resolve_external" name="mf370lnk" value="CALL"/>
|
||||
<option id="link_mark_reusable" name="mf370lnk" value="REUS"/>
|
||||
<option id="link_generate_listing" name="mf370lnk" value="NOLIST"/>
|
||||
<option id="link_create_debug_info" name="mf370lnk" value="ANIM"/>
|
||||
<option id="link_mark_reentrant" name="mf370lnk" value="RENT"/>
|
||||
<option id="link_addressing_mode" name="mf370lnk" value="AMODE(31)"/>
|
||||
</options>
|
||||
</asm_link_settings>
|
||||
<asm_cics_settings enabled="false" xsi:type="assemblerCicsSettings">
|
||||
<options>
|
||||
<option id="cics_insert_epilog_macros" name="mf370chkCics" value="EPILOG"/>
|
||||
<option id="cics_unsupported_option" name="mf370chkCics" value="UOPT(E)"/>
|
||||
<option id="cics_insert_prolog_macros" name="mf370chkCics" value="PROLOG"/>
|
||||
<option id="cics_unsupported_function" name="mf370chkCics" value="UFUNC(E)"/>
|
||||
</options>
|
||||
</asm_cics_settings>
|
||||
<asm_autolink_settings enabled="true" xsi:type="assemblerAutoLinkSettings">
|
||||
<options>
|
||||
<option id="autolink_residency_mode" name="mf370chkAutoLink" value="RMODE(31)"/>
|
||||
<option id="autolink_mark_reusable" name="mf370chkAutoLink" value="REUS"/>
|
||||
<option id="autolink_resolve_external" name="mf370chkAutoLink" value="CALL"/>
|
||||
<option id="autolink_linker_output" name="mf370chkAutoLink" value="OMF(390)"/>
|
||||
<option id="autolink_addressing_mode" name="mf370chkAutoLink" value="AMODE(31)"/>
|
||||
</options>
|
||||
</asm_autolink_settings>
|
||||
<preprocessors_settings xsi:type="preprocessorsSettings"/>
|
||||
<code_analysis_settings enabled="false" genDataFiles="false" keepDataFiles="false" xsi:type="codeAnalysisSettings"/>
|
||||
</settings>
|
||||
<files xsi:type="projectFileStore">
|
||||
<filetype type="cobol" xsi:type="cobolFileContainer">
|
||||
<file compile="true" path="GildedRose.cbl" xsi:type="cobolFile"/>
|
||||
</filetype>
|
||||
<filetype type="cobol.copybook" xsi:type="cobolFileContainer"/>
|
||||
</files>
|
||||
</project>
|
||||
2
COBOL/mf/src/.gitignore
vendored
2
COBOL/mf/src/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
.cobolBuild
|
||||
/Gilded_Rose.bin/
|
||||
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Gilded Rose</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.microfocus.eclipse.project.cobolBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.microfocus.eclipse.project.cobolNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@ -1,72 +0,0 @@
|
||||
program-id. GildedRose as "GildedRose".
|
||||
|
||||
file-control.
|
||||
select in-items assign 'in-items'.
|
||||
select items assign 'items'.
|
||||
|
||||
data division.
|
||||
file section.
|
||||
fd in-items.
|
||||
01 in-item pic x(58).
|
||||
fd items.
|
||||
01 item.
|
||||
02 sell-in pic 9(4).
|
||||
02 quality pic 9(4).
|
||||
02 name pic x(50).
|
||||
|
||||
working-storage section.
|
||||
procedure division.
|
||||
open input in-items output items.
|
||||
start-lable.
|
||||
read in-items end go to end-lable.
|
||||
move in-item to item.
|
||||
if name not equal "Aged Brie" and name not equal "Backstage passes to a TAFKAL80ETC concert"
|
||||
if quality greater then 0
|
||||
if name not equal to "Sulfuras, Hand of Ragnaros"
|
||||
compute quality = quality - 1
|
||||
end-if
|
||||
end-if
|
||||
else
|
||||
if quality is less then 50
|
||||
compute quality = quality + 1
|
||||
if name equals "Backstage passes to a TAFKAL80ETC concert"
|
||||
if sell-in less then 11
|
||||
if quality less then 50
|
||||
compute quality = quality + 1
|
||||
end-if
|
||||
end-if
|
||||
if sell-in less then 6
|
||||
if quality less then 50
|
||||
compute quality = quality + 1
|
||||
end-if
|
||||
end-if
|
||||
end-if
|
||||
end-if
|
||||
end-if
|
||||
if name not equal "Sulfuras, Hand of Ragnaros"
|
||||
compute sell-in = sell-in - 1
|
||||
end-if
|
||||
if sell-in is less then 0
|
||||
if name is not equal to "Aged Brie"
|
||||
if name is not equal to "Backstage passes to a TAFKAL80ETC concert"
|
||||
if quality is greater then 0
|
||||
if name is equal to "Sulfuras, Hand of Ragnaros"
|
||||
compute quality = quality - 1
|
||||
end-if
|
||||
end-if
|
||||
else
|
||||
compute quality = quality - quality
|
||||
end-if
|
||||
else
|
||||
if quality is less then 50
|
||||
compute quality = quality + 1
|
||||
end-if
|
||||
end-if
|
||||
end-if
|
||||
write item.
|
||||
go to start-lable.
|
||||
end-lable.
|
||||
close items.
|
||||
goback.
|
||||
|
||||
end program GildedRose.
|
||||
@ -1,157 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="cobolProject" name="Tests" uuid="d5f7cafb-a22e-4fe6-9bb2-1f9a673a4e7d" version="4.0">
|
||||
<settings xsi:type="projectSettingsContainer">
|
||||
<cobol_settings xsi:type="cobolSettings">
|
||||
<options>
|
||||
<option name="WARNING" value="1"/>
|
||||
<option name="DIALECT" value="MF"/>
|
||||
<option name="CHARSET" value="ASCII"/>
|
||||
<option name="MAX-ERROR" value="100"/>
|
||||
<option name="SOURCEFORMAT" value="variable"/>
|
||||
</options>
|
||||
<createJar value="false"/>
|
||||
<createJarAfterBuild value="false"/>
|
||||
<debug value="true"/>
|
||||
<enableCodeCoverage value="true"/>
|
||||
<enableProfiler value="false"/>
|
||||
<generate value="false"/>
|
||||
<retainDirectivesFile value="false"/>
|
||||
<genListFile value="false"/>
|
||||
<packageToFolderMapping value="false"/>
|
||||
<useJvmDynamicCalls value="false"/>
|
||||
<useJvmIncrementalBuild value="false"/>
|
||||
<verbose value="false"/>
|
||||
</cobol_settings>
|
||||
<copybook-paths xsi:type="copybookPathsSettings">
|
||||
<path enabled="true" name="/Tests" type="mfpath"/>
|
||||
<path enabled="true" name="/Gilded Rose" type="mfpath"/>
|
||||
<path enabled="false" name="/Tests/Coverage" type="mfpath"/>
|
||||
</copybook-paths>
|
||||
<build-precedence-paths xsi:type="buildPrecedenceSettings">
|
||||
<path enabled="true" name="/Tests" type="mfpath"/>
|
||||
<path enabled="true" name="/Tests/Coverage" type="mfpath"/>
|
||||
</build-precedence-paths>
|
||||
<configurations default="Tests" linkedWith="2017" xsi:type="buildConfigurationsContainer">
|
||||
<configuration description="Tests" type="single_dll" is64bit="false" createlbr="false" platform="Windows" xsi:type="cobolBuildConfiguration">
|
||||
<targetdir name="Tests.bin"/>
|
||||
<application_configuration xsi:type="runtimeConfigurationSettings">
|
||||
<cobol_switches xsi:type="projectCobolSwitches"/>
|
||||
<rts_switches xsi:type="projectRtsSwitches"/>
|
||||
<envScriptParameters></envScriptParameters>
|
||||
<envScriptPath></envScriptPath>
|
||||
<inheritBuildEnv>false</inheritBuildEnv>
|
||||
<tunables>
|
||||
<tunable index="0" name="screen_lines" value="25"/>
|
||||
<tunable index="0" name="screen_cols" value="80"/>
|
||||
</tunables>
|
||||
</application_configuration>
|
||||
<link_settings xsi:type="linkSettings">
|
||||
<additional_options value=""/>
|
||||
<rts_bind value="false"/>
|
||||
<custom_link_command value=""/>
|
||||
<debug value="false"/>
|
||||
<entry_point name=""/>
|
||||
<entry_point_runtime value="false"/>
|
||||
<error_undefined_syms value="false"/>
|
||||
<application_type value="console"/>
|
||||
<include_cpp value="false"/>
|
||||
<additional_files/>
|
||||
<rcfile path=""/>
|
||||
<rts_type value="shared"/>
|
||||
<target name="Tests"/>
|
||||
<targettype type="dll/cso"/>
|
||||
<threaded_rts value="true"/>
|
||||
<verbose value="false"/>
|
||||
</link_settings>
|
||||
</configuration>
|
||||
</configurations>
|
||||
<ims_settings xsi:type="additionalImsSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
<generatedFileDir name=""/>
|
||||
<imsDatabaseDir name=""/>
|
||||
</ims_settings>
|
||||
<mfs_settings xsi:type="mfsSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/MFS/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
</mfs_settings>
|
||||
<dbd_settings xsi:type="dbdSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/DBD/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
<cleanDbdOutputFiles value="false"/>
|
||||
</dbd_settings>
|
||||
<psb_settings xsi:type="psbSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/PSB/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
<cleanPsbOutputFiles value="false"/>
|
||||
</psb_settings>
|
||||
<bms_settings xsi:type="bmsSettings">
|
||||
<options>
|
||||
<option id="dsect" name="bmsSettings" value="/SYSPARM=DSECT"/>
|
||||
<option id="decimalchar" name="bmsSettings" value="/DP=."/>
|
||||
<option id="currencychar" name="bmsSettings" value="/CS=$"/>
|
||||
<option id="sdf" name="bmsSettings" value="/IGNORE"/>
|
||||
<option id="map" name="bmsSettings" value="/SYSPARM=MAP"/>
|
||||
</options>
|
||||
</bms_settings>
|
||||
<dependent-projects xsi:type="dependentProjectsSettings">
|
||||
<dependent-project name="Gilded Rose"/>
|
||||
</dependent-projects>
|
||||
<asm_settings xsi:type="assemblerCompileSettings">
|
||||
<options>
|
||||
<option id="compile_pre_assm_macros" name="mf370chk" value="NOMPC"/>
|
||||
<option id="compile_mark_reentrant" name="mf370chk" value="RENT"/>
|
||||
<option id="compile_create_optimized_code" name="mf370chk" value="NOOPT"/>
|
||||
<option id="compile_aat_info" name="mf370chk" value="NOAAT"/>
|
||||
<option id="compile_cross_ref_listing" name="mf370chk" value="NOXREF"/>
|
||||
<option id="compile_create_debug_info" name="mf370chk" value="ANIM"/>
|
||||
<option id="compile_generate_listing" name="mf370chk" value="NOLIST"/>
|
||||
</options>
|
||||
</asm_settings>
|
||||
<asm_link_settings xsi:type="assemblerLinkSettings">
|
||||
<options>
|
||||
<option id="link_residency_mode" name="mf370lnk" value="RMODE(31)"/>
|
||||
<option id="link_linker_output" name="mf370lnk" value="OMF(390)"/>
|
||||
<option id="link_resolve_external" name="mf370lnk" value="CALL"/>
|
||||
<option id="link_mark_reusable" name="mf370lnk" value="REUS"/>
|
||||
<option id="link_generate_listing" name="mf370lnk" value="NOLIST"/>
|
||||
<option id="link_create_debug_info" name="mf370lnk" value="ANIM"/>
|
||||
<option id="link_mark_reentrant" name="mf370lnk" value="RENT"/>
|
||||
<option id="link_addressing_mode" name="mf370lnk" value="AMODE(31)"/>
|
||||
</options>
|
||||
</asm_link_settings>
|
||||
<asm_cics_settings enabled="false" xsi:type="assemblerCicsSettings">
|
||||
<options>
|
||||
<option id="cics_insert_epilog_macros" name="mf370chkCics" value="EPILOG"/>
|
||||
<option id="cics_unsupported_option" name="mf370chkCics" value="UOPT(E)"/>
|
||||
<option id="cics_insert_prolog_macros" name="mf370chkCics" value="PROLOG"/>
|
||||
<option id="cics_unsupported_function" name="mf370chkCics" value="UFUNC(E)"/>
|
||||
</options>
|
||||
</asm_cics_settings>
|
||||
<asm_autolink_settings enabled="true" xsi:type="assemblerAutoLinkSettings">
|
||||
<options>
|
||||
<option id="autolink_residency_mode" name="mf370chkAutoLink" value="RMODE(31)"/>
|
||||
<option id="autolink_mark_reusable" name="mf370chkAutoLink" value="REUS"/>
|
||||
<option id="autolink_resolve_external" name="mf370chkAutoLink" value="CALL"/>
|
||||
<option id="autolink_linker_output" name="mf370chkAutoLink" value="OMF(390)"/>
|
||||
<option id="autolink_addressing_mode" name="mf370chkAutoLink" value="AMODE(31)"/>
|
||||
</options>
|
||||
</asm_autolink_settings>
|
||||
<preprocessors_settings xsi:type="preprocessorsSettings"/>
|
||||
<code_analysis_settings enabled="false" genDataFiles="false" keepDataFiles="false" xsi:type="codeAnalysisSettings"/>
|
||||
</settings>
|
||||
<files xsi:type="projectFileStore">
|
||||
<filetype type="cobol" xsi:type="cobolFileContainer">
|
||||
<file compile="true" path="TestGildedRose.cbl" xsi:type="cobolFile"/>
|
||||
</filetype>
|
||||
<filetype type="cobol.copybook" xsi:type="cobolFileContainer"/>
|
||||
</files>
|
||||
</project>
|
||||
3
COBOL/mf/test/.gitignore
vendored
3
COBOL/mf/test/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
/.cobolBuild
|
||||
/Coverage/
|
||||
/Tests.bin/
|
||||
@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Tests</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.microfocus.eclipse.project.cobolBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.microfocus.eclipse.mfunit.core.mfUnitBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.microfocus.eclipse.project.cobolNature</nature>
|
||||
<nature>com.microfocus.eclipse.mfunit.core.mfUnitNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@ -1,67 +0,0 @@
|
||||
*> Test Fixture for GildedRose, GildedRose
|
||||
|
||||
copy "mfunit_prototypes.cpy".
|
||||
|
||||
program-id. TestGildedRose.
|
||||
|
||||
file-control.
|
||||
select in-items assign 'in-items'.
|
||||
select items assign 'items'.
|
||||
|
||||
file section.
|
||||
fd in-items.
|
||||
01 in-item.
|
||||
02 sell-in pic 9(4).
|
||||
02 quality pic 9(4).
|
||||
02 name pic x(50).
|
||||
fd items.
|
||||
01 item.
|
||||
02 sell-in pic 9(4).
|
||||
02 quality pic 9(4).
|
||||
02 name pic x(50).
|
||||
|
||||
working-storage section.
|
||||
copy "mfunit.cpy".
|
||||
78 TEST-TESTGILDEDROSE value "TestGildedRose".
|
||||
01 pp procedure-pointer.
|
||||
|
||||
*> Program linkage data
|
||||
|
||||
procedure division.
|
||||
goback returning 0
|
||||
.
|
||||
|
||||
entry MFU-TC-PREFIX & TEST-TESTGILDEDROSE.
|
||||
open output in-items
|
||||
move "foo" to name in in-item
|
||||
move 0 to quality in in-item
|
||||
move 0 to sell-in in in-item
|
||||
write in-item
|
||||
close in-items
|
||||
call "GildedRose"
|
||||
open input items
|
||||
read items
|
||||
if name in item not equal to "fixme" then
|
||||
call MFU-ASSERT-FAIL-Z using z"item name was not fixme"
|
||||
close items
|
||||
goback
|
||||
.
|
||||
|
||||
$region TestCase Configuration
|
||||
|
||||
entry MFU-TC-SETUP-PREFIX & TEST-TESTGILDEDROSE.
|
||||
perform InitializeLinkageData
|
||||
*> Add any other test setup code here
|
||||
goback returning 0
|
||||
.
|
||||
|
||||
InitializeLinkageData section.
|
||||
*> Load the library that is being tested
|
||||
set pp to entry "GildedRose"
|
||||
|
||||
exit section
|
||||
.
|
||||
|
||||
$end-region
|
||||
|
||||
end program.
|
||||
17
Delphi/.gitattributes
vendored
17
Delphi/.gitattributes
vendored
@ -1,17 +0,0 @@
|
||||
# Set the default behavior, in case people don't have core.autocrlf set.
|
||||
* text=auto
|
||||
|
||||
# Explicitly declare text files you want to always be normalized and converted
|
||||
# to native line endings on checkout.
|
||||
*.groupproj text
|
||||
*.dpr text
|
||||
*.dproj text
|
||||
*.pas text
|
||||
*.dfm text
|
||||
*.fmx text
|
||||
|
||||
# Declare files that will always have CRLF line endings on checkout.
|
||||
|
||||
# Denote all files that are truly binary and should not be modified.
|
||||
*.exe binary
|
||||
*.res binary
|
||||
71
Delphi/.gitignore
vendored
71
Delphi/.gitignore
vendored
@ -1,71 +0,0 @@
|
||||
# Uncomment these types if you want even more clean repository. But be careful.
|
||||
# It can make harm to an existing project source. Read explanations below.
|
||||
#
|
||||
# Resource files are binaries containing manifest, project icon and version info.
|
||||
# They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files.
|
||||
*.res
|
||||
#
|
||||
# Type library file (binary). In old Delphi versions it should be stored.
|
||||
# Since Delphi 2009 it is produced from .ridl file and can safely be ignored.
|
||||
#*.tlb
|
||||
#
|
||||
# Diagram Portfolio file. Used by the diagram editor up to Delphi 7.
|
||||
# Uncomment this if you are not using diagrams or use newer Delphi version.
|
||||
#*.ddp
|
||||
#
|
||||
# Visual LiveBindings file. Added in Delphi XE2.
|
||||
# Uncomment this if you are not using LiveBindings Designer.
|
||||
#*.vlb
|
||||
#
|
||||
# Deployment Manager configuration file for your project. Added in Delphi XE2.
|
||||
# Uncomment this if it is not mobile development and you do not use remote debug feature.
|
||||
#*.deployproj
|
||||
#
|
||||
# C++ object files produced when C/C++ Output file generation is configured.
|
||||
# Uncomment this if you are not using external objects (zlib library for example).
|
||||
#*.obj
|
||||
#
|
||||
|
||||
# Delphi compiler-generated binaries (safe to delete)
|
||||
*.exe
|
||||
*.dll
|
||||
*.bpl
|
||||
*.bpi
|
||||
*.dcp
|
||||
*.so
|
||||
*.apk
|
||||
*.drc
|
||||
*.map
|
||||
*.dres
|
||||
*.rsm
|
||||
*.tds
|
||||
*.dcu
|
||||
*.lib
|
||||
*.a
|
||||
*.o
|
||||
*.ocx
|
||||
|
||||
# Delphi autogenerated files (duplicated info)
|
||||
*.cfg
|
||||
*.hpp
|
||||
*Resource.rc
|
||||
|
||||
# Delphi local files (user-specific info)
|
||||
*.local
|
||||
*.identcache
|
||||
*.projdata
|
||||
*.tvsconfig
|
||||
*.dsk
|
||||
|
||||
# Delphi history and backups
|
||||
__history/
|
||||
__recovery/
|
||||
*.~*
|
||||
|
||||
# Castalia statistics file (since XE7 Castalia is distributed with Delphi)
|
||||
*.stat
|
||||
|
||||
# Ignore Build outputs
|
||||
Build
|
||||
Win32
|
||||
Win64
|
||||
@ -1,48 +0,0 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{3E0B3749-4258-486E-A44B-05088E7E42D6}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Projects Include="TextTestFixture.dproj">
|
||||
<Dependencies/>
|
||||
</Projects>
|
||||
<Projects Include="UnitTests.dproj">
|
||||
<Dependencies/>
|
||||
</Projects>
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>Default.Personality.12</Borland.Personality>
|
||||
<Borland.ProjectType/>
|
||||
<BorlandProject>
|
||||
<Default.Personality/>
|
||||
</BorlandProject>
|
||||
</ProjectExtensions>
|
||||
<Target Name="TextTestFixture">
|
||||
<MSBuild Projects="TextTestFixture.dproj"/>
|
||||
</Target>
|
||||
<Target Name="TextTestFixture:Clean">
|
||||
<MSBuild Projects="TextTestFixture.dproj" Targets="Clean"/>
|
||||
</Target>
|
||||
<Target Name="TextTestFixture:Make">
|
||||
<MSBuild Projects="TextTestFixture.dproj" Targets="Make"/>
|
||||
</Target>
|
||||
<Target Name="UnitTests">
|
||||
<MSBuild Projects="UnitTests.dproj"/>
|
||||
</Target>
|
||||
<Target Name="UnitTests:Clean">
|
||||
<MSBuild Projects="UnitTests.dproj" Targets="Clean"/>
|
||||
</Target>
|
||||
<Target Name="UnitTests:Make">
|
||||
<MSBuild Projects="UnitTests.dproj" Targets="Make"/>
|
||||
</Target>
|
||||
<Target Name="Build">
|
||||
<CallTarget Targets="TextTestFixture;UnitTests"/>
|
||||
</Target>
|
||||
<Target Name="Clean">
|
||||
<CallTarget Targets="TextTestFixture:Clean;UnitTests:Clean"/>
|
||||
</Target>
|
||||
<Target Name="Make">
|
||||
<CallTarget Targets="TextTestFixture:Make;UnitTests:Make"/>
|
||||
</Target>
|
||||
<Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
|
||||
</Project>
|
||||
@ -1,106 +0,0 @@
|
||||
unit GildedRose;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Item,
|
||||
System.Generics.Collections;
|
||||
|
||||
type
|
||||
TGildedRose = class(TObject)
|
||||
private
|
||||
FItems: TObjectList<TItem>;
|
||||
public
|
||||
constructor Create(const AItems: TObjectList<TItem>);
|
||||
procedure UpdateQuality;
|
||||
property Items: TObjectList<TItem> read FItems;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TGildedRose }
|
||||
|
||||
constructor TGildedRose.Create(const AItems: TObjectList<TItem>);
|
||||
begin
|
||||
inherited Create;
|
||||
FItems := AItems;
|
||||
end;
|
||||
|
||||
procedure TGildedRose.UpdateQuality;
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
for I := 0 to Items.Count - 1 do
|
||||
begin
|
||||
if (Items[I].Name <> 'Aged Brie') and (Items[I].Name <> 'Backstage passes to a TAFKAL80ETC concert') then
|
||||
begin
|
||||
if Items[I].Quality > 0 then
|
||||
begin
|
||||
if Items[I].Name <> 'Sulfuras, Hand of Ragnaros' then
|
||||
begin
|
||||
Items[I].Quality := Items[I].Quality - 1;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if Items[I].Quality < 50 then
|
||||
begin
|
||||
Items[I].Quality := Items[I].Quality + 1;
|
||||
if Items[I].Name = 'Backstage passes to a TAFKAL80ETC concert' then
|
||||
begin
|
||||
if Items[I].SellIn < 11 then
|
||||
begin
|
||||
if Items[I].Quality < 50 then
|
||||
begin
|
||||
Items[I].Quality := Items[I].Quality + 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
if Items[I].SellIn < 6 then
|
||||
begin
|
||||
if Items[I].Quality < 50 then
|
||||
begin
|
||||
Items[I].Quality := Items[I].Quality + 1;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if Items[I].Name <> 'Sulfuras, Hand of Ragnaros' then
|
||||
begin
|
||||
Items[I].SellIn := Items[I].SellIn - 1;
|
||||
end;
|
||||
|
||||
if Items[I].SellIn < 0 then
|
||||
begin
|
||||
if Items[I].Name <> 'Aged Brie' then
|
||||
begin
|
||||
if Items[I].Name <> 'Backstage passes to a TAFKAL80ETC concert' then
|
||||
begin
|
||||
if Items[I].Quality > 0 then
|
||||
begin
|
||||
if Items[I].Name <> 'Sulfuras, Hand of Ragnaros' then
|
||||
begin
|
||||
Items[I].Quality := Items[I].Quality - 1;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Items[I].Quality := Items[I].Quality - Items[I].Quality;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if Items[I].Quality < 50 then
|
||||
begin
|
||||
Items[I].Quality := Items[I].Quality + 1;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
@ -1,36 +0,0 @@
|
||||
unit GildedRoseTests;
|
||||
|
||||
interface
|
||||
uses
|
||||
DUnitX.TestFramework,
|
||||
GildedRose,
|
||||
Item,
|
||||
System.Generics.Collections;
|
||||
|
||||
type
|
||||
[TestFixture]
|
||||
TGildedRoseTests = class(TObject)
|
||||
public
|
||||
[Test]
|
||||
procedure UpdateQuality_Never_ChangesTheItemName;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
procedure TGildedRoseTests.UpdateQuality_Never_ChangesTheItemName;
|
||||
var
|
||||
LItems: TObjectList<TItem>;
|
||||
LGildedRose: TGildedRose;
|
||||
begin
|
||||
LItems := TObjectList<TItem>.Create;
|
||||
LItems.Add(TItem.Create('foo', 0, 0));
|
||||
LGildedRose := TGildedRose.Create(LItems);
|
||||
|
||||
LGildedRose.UpdateQuality;
|
||||
|
||||
Assert.AreEqual('fixme', LGildedRose.Items[0].Name);
|
||||
end;
|
||||
|
||||
initialization
|
||||
TDUnitX.RegisterTestFixture(TGildedRoseTests);
|
||||
end.
|
||||
@ -1,39 +0,0 @@
|
||||
unit Item;
|
||||
|
||||
interface
|
||||
|
||||
type
|
||||
TItem = class(TObject)
|
||||
private
|
||||
FName: string;
|
||||
FSellIn: Integer;
|
||||
FQuality: Integer;
|
||||
public
|
||||
constructor Create(const AName: string; const ASellIn, AQuality: Integer);
|
||||
function ToString: string; override;
|
||||
property Name: string read FName write FName;
|
||||
property SellIn: Integer read FSellIn write FSellIn;
|
||||
property Quality: Integer read FQuality write FQuality;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
System.SysUtils;
|
||||
|
||||
{ TItem }
|
||||
|
||||
constructor TItem.Create(const AName: string; const ASellIn, AQuality: Integer);
|
||||
begin
|
||||
inherited Create;
|
||||
FName := AName;
|
||||
FSellIn := ASellIn;
|
||||
FQuality := AQuality;
|
||||
end;
|
||||
|
||||
function TItem.ToString: string;
|
||||
begin
|
||||
Result := Format('%s, %d, %d', [Name, SellIn, Quality]);
|
||||
end;
|
||||
|
||||
end.
|
||||
@ -1,13 +0,0 @@
|
||||
# Delphi port of the Gilded-Rose Kata
|
||||
This is a Delphi port of the *Gilded-Rose-Kata*.
|
||||
|
||||
## Version Compatibility
|
||||
The project files are written in Delphi 10.3.3 therefore require 10.3 or later.
|
||||
That said, the actual code should be compatible back to Delphi 2010 as the unit
|
||||
tests are written in [DUnitX](https://github.com/VSoftTechnologies/DUnitX) which
|
||||
requires Delphi 2010 or later.
|
||||
|
||||
## Building and Running
|
||||
* Open the project group `GildedRose.groupproj`.
|
||||
* Build and run the `TextTestFixture.exe` for the text output tests.
|
||||
* Build and run the `UnitTests.exe` project to execute the unit tests.
|
||||
@ -1,57 +0,0 @@
|
||||
program TextTestFixture;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
{$R *.res}
|
||||
|
||||
uses
|
||||
System.SysUtils,
|
||||
System.Generics.Collections,
|
||||
GildedRose in 'GildedRose.pas',
|
||||
Item in 'Item.pas';
|
||||
|
||||
var
|
||||
Days, ErrorCode, I, J: Integer;
|
||||
Items: TObjectList<TItem>;
|
||||
App: TGildedRose;
|
||||
|
||||
begin
|
||||
try
|
||||
Writeln('OMGHAI!');
|
||||
|
||||
Items := TObjectList<TItem>.Create;
|
||||
Items.Add(TItem.Create('+5 Dexterity Vest', 10, 20));
|
||||
Items.Add(TItem.Create('Aged Brie', 2, 0));
|
||||
Items.Add(TItem.Create('Elixir of the Mongoose', 5, 7));
|
||||
Items.Add(TItem.Create('Sulfuras, Hand of Ragnaros', 0, 80));
|
||||
Items.Add(TItem.Create('Sulfuras, Hand of Ragnaros', -1, 80));
|
||||
Items.Add(TItem.Create('Backstage passes to a TAFKAL80ETC concert', 15, 20));
|
||||
Items.Add(TItem.Create('Backstage passes to a TAFKAL80ETC concert', 10, 49));
|
||||
Items.Add(TItem.Create('Backstage passes to a TAFKAL80ETC concert', 5, 49));
|
||||
// this conjured item does not work properly yet
|
||||
Items.Add(TItem.Create('Conjured Mana Cake', 3, 6));
|
||||
|
||||
App := TGildedRose.Create(Items);
|
||||
|
||||
Days := 2;
|
||||
if ParamCount > 0 then
|
||||
begin
|
||||
Val(ParamStr(1), Days, ErrorCode);
|
||||
Inc(Days);
|
||||
end;
|
||||
|
||||
for I := 0 to Days - 1 do
|
||||
begin
|
||||
Writeln(Format('-------- day %d --------', [I]));
|
||||
Writeln('name, sellIn, quality');
|
||||
for J := 0 to Items.Count - 1 do
|
||||
Writeln(Items[J].ToString);
|
||||
Writeln;
|
||||
|
||||
App.UpdateQuality;
|
||||
end;
|
||||
except
|
||||
on E: Exception do
|
||||
Writeln(E.ClassName, ': ', E.Message);
|
||||
end;
|
||||
end.
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,59 +0,0 @@
|
||||
program UnitTests;
|
||||
|
||||
{$IFNDEF TESTINSIGHT}
|
||||
{$APPTYPE CONSOLE}
|
||||
{$ENDIF}{$STRONGLINKTYPES ON}
|
||||
uses
|
||||
System.SysUtils,
|
||||
{$IFDEF TESTINSIGHT}
|
||||
TestInsight.DUnitX,
|
||||
{$ENDIF }
|
||||
DUnitX.Loggers.Console,
|
||||
DUnitX.Loggers.Xml.NUnit,
|
||||
DUnitX.TestFramework,
|
||||
GildedRoseTests in 'GildedRoseTests.pas';
|
||||
|
||||
var
|
||||
runner : ITestRunner;
|
||||
results : IRunResults;
|
||||
logger : ITestLogger;
|
||||
nunitLogger : ITestLogger;
|
||||
begin
|
||||
{$IFDEF TESTINSIGHT}
|
||||
TestInsight.DUnitX.RunRegisteredTests;
|
||||
exit;
|
||||
{$ENDIF}
|
||||
try
|
||||
//Check command line options, will exit if invalid
|
||||
TDUnitX.CheckCommandLine;
|
||||
//Create the test runner
|
||||
runner := TDUnitX.CreateRunner;
|
||||
//Tell the runner to use RTTI to find Fixtures
|
||||
runner.UseRTTI := True;
|
||||
//tell the runner how we will log things
|
||||
//Log to the console window
|
||||
logger := TDUnitXConsoleLogger.Create(true);
|
||||
runner.AddLogger(logger);
|
||||
//Generate an NUnit compatible XML File
|
||||
nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile);
|
||||
runner.AddLogger(nunitLogger);
|
||||
runner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests;
|
||||
|
||||
//Run tests
|
||||
results := runner.Execute;
|
||||
if not results.AllPassed then
|
||||
System.ExitCode := EXIT_ERRORS;
|
||||
|
||||
{$IFNDEF CI}
|
||||
//We don't want this happening when running under CI.
|
||||
if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then
|
||||
begin
|
||||
System.Write('Done.. press <Enter> key to quit.');
|
||||
System.Readln;
|
||||
end;
|
||||
{$ENDIF}
|
||||
except
|
||||
on E: Exception do
|
||||
System.Writeln(E.ClassName, ': ', E.Message);
|
||||
end;
|
||||
end.
|
||||
@ -1,937 +0,0 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{9379A28B-85A1-455B-BE8B-BDE5DD446BDF}</ProjectGuid>
|
||||
<ProjectVersion>18.8</ProjectVersion>
|
||||
<FrameworkType>None</FrameworkType>
|
||||
<MainSource>UnitTests.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
<TargetedPlatforms>1</TargetedPlatforms>
|
||||
<AppType>Console</AppType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='iOSDevice32' and '$(Base)'=='true') or '$(Base_iOSDevice32)'!=''">
|
||||
<Base_iOSDevice32>true</Base_iOSDevice32>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='iOSDevice64' and '$(Base)'=='true') or '$(Base_iOSDevice64)'!=''">
|
||||
<Base_iOSDevice64>true</Base_iOSDevice64>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='iOSSimulator' and '$(Base)'=='true') or '$(Base_iOSSimulator)'!=''">
|
||||
<Base_iOSSimulator>true</Base_iOSSimulator>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='OSX32' and '$(Base)'=='true') or '$(Base_OSX32)'!=''">
|
||||
<Base_OSX32>true</Base_OSX32>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='OSX64' and '$(Base)'=='true') or '$(Base_OSX64)'!=''">
|
||||
<Base_OSX64>true</Base_OSX64>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
|
||||
<Base_Win32>true</Base_Win32>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
|
||||
<Base_Win64>true</Base_Win64>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
|
||||
<Cfg_1_Win32>true</Cfg_1_Win32>
|
||||
<CfgParent>Cfg_1</CfgParent>
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
|
||||
<Cfg_2>true</Cfg_2>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base)'!=''">
|
||||
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
|
||||
<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
|
||||
<DCC_E>false</DCC_E>
|
||||
<DCC_N>false</DCC_N>
|
||||
<DCC_S>false</DCC_S>
|
||||
<DCC_F>false</DCC_F>
|
||||
<DCC_K>false</DCC_K>
|
||||
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
|
||||
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
|
||||
<Icns_MainIcns>$(BDS)\bin\delphi_PROJECTICNS.icns</Icns_MainIcns>
|
||||
<DCC_UnitSearchPath>$(DUnitX);$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||
<SanitizedProjectName>UnitTests</SanitizedProjectName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_iOSDevice32)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;FmxTeeUI;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;FMXTee;soaprtl;DbxCommonDriver;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_iOSDevice64)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;FmxTeeUI;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;FMXTee;soaprtl;DbxCommonDriver;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_iOSSimulator)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;FmxTeeUI;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;FMXTee;soaprtl;DbxCommonDriver;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_OSX32)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;FireDACMSSQLDriver;bindcompfmx;DBXOracleDriver;inetdb;FmxTeeUI;fmx;FireDACIBDriver;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;FireDACPgDriver;FireDACASADriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;FireDACDSDriver;rtl;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;bindcomp;DBXInformixDriver;IndyIPClient;dbxcds;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_OSX64)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;FireDACMSSQLDriver;bindcompfmx;DBXOracleDriver;inetdb;FmxTeeUI;fmx;FireDACIBDriver;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;FireDACPgDriver;FireDACASADriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;FireDACDSDriver;rtl;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;bindcomp;DBXInformixDriver;IndyIPClient;dbxcds;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;fmxase;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;tethering;svnui;DataSnapFireDAC;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;DBXOracleDriver;inetdb;FmxTeeUI;emsedge;fmx;FireDACIBDriver;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;vcl;IndyIPServer;DBXSybaseASEDriver;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;emsserverresource;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
||||
<BT_BuildType>Debug</BT_BuildType>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;fmxase;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;tethering;DataSnapFireDAC;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;DBXOracleDriver;inetdb;FmxTeeUI;emsedge;fmx;FireDACIBDriver;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;vcl;IndyIPServer;DBXSybaseASEDriver;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;emsserverresource;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
|
||||
<DCC_DebugDCUs>true</DCC_DebugDCUs>
|
||||
<DCC_Optimize>false</DCC_Optimize>
|
||||
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
|
||||
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
|
||||
<DCC_RemoteDebug>true</DCC_RemoteDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
||||
<DCC_RemoteDebug>false</DCC_RemoteDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
||||
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
|
||||
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
||||
<DCC_DebugInformation>0</DCC_DebugInformation>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<DelphiCompile Include="$(MainSource)">
|
||||
<MainSource>MainSource</MainSource>
|
||||
</DelphiCompile>
|
||||
<DCCReference Include="GildedRoseTests.pas"/>
|
||||
<BuildConfiguration Include="Release">
|
||||
<Key>Cfg_2</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Debug">
|
||||
<Key>Cfg_1</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
||||
<Borland.ProjectType>Console</Borland.ProjectType>
|
||||
<BorlandProject>
|
||||
<Delphi.Personality>
|
||||
<Source>
|
||||
<Source Name="MainSource">UnitTests.dpr</Source>
|
||||
</Source>
|
||||
</Delphi.Personality>
|
||||
<Deployment Version="3">
|
||||
<DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule">
|
||||
<Platform Name="OSX32">
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libcgunwind.1.0.dylib" Class="DependencyModule">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libpcre.dylib" Class="DependencyModule">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployFile LocalName="Win32\Debug\UnitTests.exe" Configuration="Debug" Class="ProjectOutput">
|
||||
<Platform Name="Win32">
|
||||
<RemoteName>UnitTests.exe</RemoteName>
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployClass Name="AdditionalDebugSymbols">
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidClassesDexFile">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>classes</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>classes</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidFileProvider">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\xml</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\xml</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidGDBServer">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidLibnativeArmeabiFile">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\armeabi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidLibnativeArmeabiv7aFile">
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidLibnativeMipsFile">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\mips</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\mips</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidServiceOutput">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\arm64-v8a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidServiceOutput_Android32">
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidSplashImageDef">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidSplashStyles">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidSplashStylesV21">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\values-v21</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\values-v21</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_Colors">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_DefaultAppIcon">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon144">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon36">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-ldpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-ldpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon48">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-mdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-mdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon72">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-hdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-hdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon96">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_NotificationIcon24">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-mdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-mdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_NotificationIcon36">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-hdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-hdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_NotificationIcon48">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_NotificationIcon72">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_NotificationIcon96">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage426">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-small</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-small</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage470">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-normal</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-normal</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage640">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-large</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-large</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage960">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xlarge</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xlarge</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_Strings">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DebugSymbols">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DependencyFramework">
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.framework</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.framework</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DependencyModule">
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
<Extensions>.dll;.bpl</Extensions>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Required="true" Name="DependencyPackage">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
<Extensions>.bpl</Extensions>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="File">
|
||||
<Platform Name="Android">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch1024x768">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch1536x2048">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch1668">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch1668x2388">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch2048x1536">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch2048x2732">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch2224">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch2388x1668">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch2732x2048">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch768x1024">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch1125">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch1136x640">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch1242">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch1242x2688">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch1334">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch1792">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch2208">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch2436">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch2688x1242">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch320">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch640">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch640x1136">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch750">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch828">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectAndroidManifest">
|
||||
<Platform Name="Android">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceDebug">
|
||||
<Platform Name="iOSDevice32">
|
||||
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
|
||||
<DeployClass Name="ProjectiOSEntitlements"/>
|
||||
<DeployClass Name="ProjectiOSInfoPList"/>
|
||||
<DeployClass Name="ProjectiOSResource">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXDebug"/>
|
||||
<DeployClass Name="ProjectOSXEntitlements"/>
|
||||
<DeployClass Name="ProjectOSXInfoPList"/>
|
||||
<DeployClass Name="ProjectOSXResource">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\Resources</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<RemoteDir>Contents\Resources</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Required="true" Name="ProjectOutput">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\arm64-v8a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Linux64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOutput_Android32">
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectUWPManifest">
|
||||
<Platform Name="Win32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="UWP_DelphiLogo150">
|
||||
<Platform Name="Win32">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="UWP_DelphiLogo44">
|
||||
<Platform Name="Win32">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
|
||||
</Deployment>
|
||||
<Platforms>
|
||||
<Platform value="iOSDevice32">False</Platform>
|
||||
<Platform value="iOSDevice64">False</Platform>
|
||||
<Platform value="iOSSimulator">False</Platform>
|
||||
<Platform value="OSX32">False</Platform>
|
||||
<Platform value="OSX64">False</Platform>
|
||||
<Platform value="Win32">True</Platform>
|
||||
<Platform value="Win64">False</Platform>
|
||||
</Platforms>
|
||||
</BorlandProject>
|
||||
<ProjectFileVersion>12</ProjectFileVersion>
|
||||
</ProjectExtensions>
|
||||
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
|
||||
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
|
||||
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
|
||||
</Project>
|
||||
@ -1,45 +0,0 @@
|
||||
# Especificaciones de la Rosa Dorada (Gilded Rose)
|
||||
|
||||
Bienvenido al equipo de **Gilded Rose**.
|
||||
Como quizá sabes, somos una pequeña posada ubicada estratégicamente en una prestigiosa ciudad, atendida por la amable **Allison**.
|
||||
También compramos y vendemos mercadería de alta calidad.
|
||||
Por desgracia, nuestra mercadería va bajando de calidad a medida que se aproxima la fecha de venta.
|
||||
|
||||
Tenemos un sistema instalado que actualiza automáticamente el `inventario`.
|
||||
Este sistema fue desarrollado por un muchacho con poco sentido común llamado Leeroy, que ahora se dedica a nuevas aventuras.
|
||||
Tu tarea es agregar una nueva característica al sistema para que podamos comenzar a vender una nueva categoría de items.
|
||||
|
||||
## Descripción preliminar
|
||||
|
||||
Pero primero, vamos a introducir el sistema:
|
||||
|
||||
* Todos los artículos (`Item`) tienen una propiedad `sellIn` que denota el número de días que tenemos para venderlo
|
||||
* Todos los artículos tienen una propiedad `quality` que denota cúan valioso es el artículo
|
||||
* Al final de cada día, nuestro sistema decrementa ambos valores para cada artículo mediante el método `updateQuality`
|
||||
|
||||
Bastante simple, ¿no? Bueno, ahora es donde se pone interesante:
|
||||
|
||||
* Una vez que ha pasado la fecha recomendada de venta, la `calidad` se degrada al doble de velocidad
|
||||
* La `calidad` de un artículo nunca es negativa
|
||||
* El "Queso Brie envejecido" (`Aged brie`) incrementa su `calidad` a medida que se pone viejo
|
||||
* Su `calidad` aumenta en `1` unidad cada día
|
||||
* luego de la `fecha de venta` su `calidad` aumenta `2` unidades por día
|
||||
* La `calidad` de un artículo nunca es mayor a `50`
|
||||
* El artículo "Sulfuras" (`Sulfuras`), siendo un artículo legendario, no modifica su `fecha de venta` ni se degrada en `calidad`
|
||||
* Una "Entrada al Backstage", como el queso brie, incrementa su `calidad` a medida que la `fecha de venta` se aproxima
|
||||
* si faltan 10 días o menos para el concierto, la `calidad` se incrementa en `2` unidades
|
||||
* si faltan 5 días o menos, la `calidad` se incrementa en `3` unidades
|
||||
* luego de la `fecha de venta` la `calidad` cae a `0`
|
||||
|
||||
## El requerimiento
|
||||
|
||||
Hace poco contratamos a un proveedor de artículos *conjurados mágicamente*.
|
||||
Esto requiere una actualización del sistema:
|
||||
|
||||
* Los artículos `conjurados` degradan su `calidad` al doble de velocidad que los normales
|
||||
|
||||
Siéntete libre de realizar cualquier cambio al mensaje `updateQuality` y agregar el código que sea necesario, mientras que todo siga funcionando correctamente. Sin embargo, **no alteres el objeto `Item` ni sus propiedades** ya que pertenecen al goblin que está en ese rincón, que en un ataque de ira te va a liquidar de un golpe porque no cree en la cultura de código compartido.
|
||||
|
||||
## Notas finales
|
||||
|
||||
Para aclarar: un artículo nunca puede tener una `calidad` superior a `50`, sin embargo las Sulfuras siendo un artículo legendario posee una calidad inmutable de `80`.
|
||||
@ -1,35 +0,0 @@
|
||||
# Especificações de Requisitos de Gilded Rose
|
||||
|
||||
Bem-vindo ao time Gilded Rose. Como você deve saber, nós somos uma pequena pousada estrategicamente localizada em uma prestigiosa cidade, atendida pelo amigavel atendente Allison. Além de ser uma pousada, nós também compramos e vendemos as mercadorias de melhor qualidade. Infelizmente nossas mercadorias vão perdendo a qualidade conforme chegam próximo sua data de venda.
|
||||
|
||||
Nós temos um sistema instalado que atualiza automaticamente os preços do nosso estoque. Esse sistema foi criado por um rapaz sem noção chamado Leeroy, que agora se dedica à novas aventuras. Seu trabalho será adicionar uma nova funcionalidade para o nosso sistema para que possamos vender uma nova categoria de itens.
|
||||
|
||||
## Descrição preliminar
|
||||
|
||||
Vamos dar uma breve introdução do nosso sistema:
|
||||
|
||||
* Todos os itens (classe `Item`) possuem uma propriedade chamada `SellIn` que informa o número de dias que temos para vende-lo
|
||||
* Todos os itens possuem uma propriedade chamada `quality` que informa o quão valioso é o item.
|
||||
* No final do dia, nosso sistema decrementa os valores das propriedades `SellIn` e `quality` de cada um dos itens do estoque através do método `updateQuality`.
|
||||
|
||||
Bastante simples, não é? Bem, agora que as coisas ficam interessantes:
|
||||
|
||||
* Quando a data de venda do item tiver passado, a qualidade (`quality`) do item diminui duas vezes mais rapido.
|
||||
* A qualidade (`quality`) do item não pode ser negativa
|
||||
* O "Queijo Brie envelhecido" (`Aged Brie`), aumenta sua qualidade (`quality`) em `1` unidade a medida que envelhece.
|
||||
* A qualidade (`quality`) de um item não pode ser maior que 50.
|
||||
* O item "Sulfuras" (`Sulfuras`), por ser um item lendário, não precisa ter uma data de venda (`SellIn`) e sua qualidade (`quality`) não precisa ser diminuida.
|
||||
* O item "Entrada para os Bastidores" (`Backstage Passes`), assim como o "Queijo Brie envelhecido", aumenta sua qualidade (`quality`) a medida que o dia da venda (`SellIn`) se aproxima;
|
||||
* A qualidade (`quality`) aumenta em `2` unidades quando a data de venda (`SellIn`) é igual ou menor que `10`.
|
||||
* A qualidade (`quality`) aumenta em `3` unidades quando a data de venda (`SellIn`) é igual ou menor que `5`.
|
||||
* A qualidade (`quality`) do item vai direto à `0` quando a data de venda (`SellIn`) tiver passado.
|
||||
|
||||
Nós recentemente assinamos um suprimento de itens Conjurados Magicamente. Isto requer que nós atualizemos nosso sistema:
|
||||
|
||||
* Os itens "Conjurados" (`Conjured`) diminuem a qualidade (`quality`) duas vezes mais rápido que os outros itens.
|
||||
|
||||
Sinta-se livre para fazer qualquer alteração no método `updateQuality` e adicionar código novo contanto que tudo continue funcionando perfeitamente. Entretanto, não altere o código da classe `Item` ou da propriedade `Items` na classe `GildedRose` pois elas pertencem ao Goblin que irá te matar com um golpe pois ele não acredita na cultura de código compartilhado.
|
||||
|
||||
## Notas Finais
|
||||
|
||||
Para esclarecer: Um item não pode ter uma qualidade (`quality`) maior que `50`, entretanto as "Sulfuras" por serem um item lendário vão ter uma qualidade imutavel de `80`.
|
||||
@ -1,43 +0,0 @@
|
||||
======================================
|
||||
Технические требования «Gilded Rose»
|
||||
======================================
|
||||
|
||||
Привет и добро пожаловать в команду «Gilded Rose». Как вы знаете, мы небольшая гостиница удобно расположенная
|
||||
в известном городе под руководством дружественного управляющего по имени Эллисон. Также мы занимаемся покупкой
|
||||
и продажей только самых лучших товаров. К несчастью, качество наших товаров постоянно ухудшается по мере приближения
|
||||
к максимальному сроку хранения. Существует информационная система, которая ведет переучет всех товаров. Система
|
||||
была разработана рубаха-парнем, по имени Leeroy, который отправился за поисками новых приключений. Ваша задача
|
||||
заключается в том, чтобы добавить новый функционал в нашу систему, чтобы мы могли начать продавать новую категорию
|
||||
товаров.
|
||||
|
||||
В общих чертах система работает следующим образом:
|
||||
|
||||
- Все товары имеют свойство «sellIn» (срок хранения), которое обозначает количество
|
||||
дней в течение которых мы должны продать товар;
|
||||
- Все товары имеют свойство «Quality» (качество), которое обозначает насколько качественным является товар;
|
||||
- В конце дня наша система снижает значение обоих свойств для каждого товара.
|
||||
|
||||
Довольно просто, не правда ли? Тут-то и начинается самое интересное:
|
||||
|
||||
- После того, как срок храния прошел, качество товара ухудшается в два раза быстрее;
|
||||
- Качество товара никогда не может быть отрицательным;
|
||||
- Для товара «Aged Brie» качество увеличивается пропорционально возрасту;
|
||||
- Качество товара никогда не может быть больше, чем 50;
|
||||
- «Sulfuras» является легендарным товаром, поэтому у него нет срока хранения и не подвержен ухудшению качества;
|
||||
- Качество «Backstage passes» также, как и «Aged Brie», увеличивается по мере приближения к сроку хранения.
|
||||
Качество увеличивается на 2, когда до истечения срока хранения 10 или менее дней и на 3,
|
||||
если до истечения 5 или менее дней. При этом качество падает до 0 после даты проведения концерта.
|
||||
|
||||
Недавно мы нашли поставщика магических товаров. Для того, чтобы продавать его товары необходимо обновить нашу
|
||||
систему следующим образом:
|
||||
|
||||
- «Conjured» товары теряют качество в два раза быстрее, чем обычные товары.
|
||||
|
||||
Не стесняйтесь вносить любые изменения в метод «UpdateQuality» и добавлять любой новый код до тех пор,
|
||||
пока система работает корректно. Тем не менее, не меняйте класс «Item» или его свойства, так как он принадлежит
|
||||
сидящему в углу гоблину, который очень яростен и поэтому выстрелит в вас поскольку не верит в принцип
|
||||
совместного владения кодом (вы можете сделать метод «UpdateQuality» и свойства класса «Item» статическими
|
||||
если хотите, мы вас прикроем).
|
||||
|
||||
Просто для уточнения, товар никогда не может иметь качество выше чем 50, однако легендарный товар «Sulfuras»
|
||||
имеет качество 80 и оно никогда не меняется.
|
||||
@ -1,32 +0,0 @@
|
||||
======================================
|
||||
Gilded Rose 需求描述
|
||||
======================================
|
||||
|
||||
|
||||
欢迎来到镶金玫瑰(Gilded Rose)团队。如你所知,我们是主城中的一个小旅店,店主非常友好,名叫Allison。我们也售卖最好的物品。不幸的是,物品品质会随着销售期限的接近而不断下降。
|
||||
我们有一个系统来更新库存信息。系统是由一个无名之辈Leeroy所开发的,他已经不在这了。
|
||||
你的任务是添加新功能,这样我们就可以售卖新的物品。
|
||||
|
||||
先介绍一下我们的系统:
|
||||
|
||||
- 每种物品都具备一个`SellIn`值,表示我们要在多少天之前把物品卖出去,即销售期
|
||||
- 每种的物品都具备一个`Quality`值,表示物品的品质
|
||||
- 每天结束时,系统会降低每种物品的这两个数值
|
||||
|
||||
很简单吧?这还有些更有意思的:
|
||||
|
||||
- 一旦销售期限过期,品质`Quality`会以双倍速度加速下降
|
||||
- 物品的品质`Quality`永远不会为负值
|
||||
- "Aged Brie"的品质`Quality`会随着时间推移而提高
|
||||
- 物品的品质`Quality`永远不会超过50
|
||||
- 传奇物品"Sulfuras"永不到期,也不会降低品质`Quality`
|
||||
- "Backstage passes"与aged brie类似,其品质`Quality`会随着时间推移而提高;当还剩10天或更少的时候,品质`Quality`每天提高2;当还剩5天或更少的时候,品质`Quality`每天提高3;但一旦过期,品质就会降为0
|
||||
|
||||
|
||||
我们最近签约了一个召唤物品供应商。这需要对我们的系统进行升级:
|
||||
|
||||
- "Conjured"物品的品质`Quality`下降速度比正常物品快一倍
|
||||
|
||||
请随意对UpdateQuality()函数进行修改和添加新代码,只要系统还能正常工作。然而,不要修改Item类或其属性,因为那属于角落里的地精,他会非常愤怒地爆你头,因为他不相信代码共享所有制(如果你愿意,你可以将UpdateQuality方法和Items属性改为静态的,我们会掩护你的)。
|
||||
|
||||
再次澄清,每种物品的品质不会超过50,然而"Sulfuras"是一个传奇物品,因此它的品质是80且永远不变。
|
||||
124
Groovy/.gitignore
vendored
124
Groovy/.gitignore
vendored
@ -1,124 +0,0 @@
|
||||
|
||||
# Created by https://www.gitignore.io/api/groovy,intellij,eclipse,vim
|
||||
|
||||
#!! ERROR: groovy is undefined. Use list command to see defined gitignore types !!#
|
||||
|
||||
### Intellij ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff:
|
||||
.idea/workspace.xml
|
||||
.idea/tasks.xml
|
||||
.idea/dictionaries
|
||||
.idea/vcs.xml
|
||||
.idea/jsLibraryMappings.xml
|
||||
|
||||
# Sensitive or high-churn files:
|
||||
.idea/dataSources.ids
|
||||
.idea/dataSources.xml
|
||||
.idea/dataSources.local.xml
|
||||
.idea/sqlDataSources.xml
|
||||
.idea/dynamic.xml
|
||||
.idea/uiDesigner.xml
|
||||
|
||||
# Gradle:
|
||||
.idea/gradle.xml
|
||||
.idea/libraries
|
||||
|
||||
# Mongo Explorer plugin:
|
||||
.idea/mongoSettings.xml
|
||||
|
||||
## File-based project format:
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
/out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
### Intellij Patch ###
|
||||
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
||||
|
||||
# *.iml
|
||||
# modules.xml
|
||||
|
||||
|
||||
### Eclipse ###
|
||||
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.settings/
|
||||
.loadpath
|
||||
.recommenders
|
||||
|
||||
# Eclipse Core
|
||||
.project
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# PyDev specific (Python IDE for Eclipse)
|
||||
*.pydevproject
|
||||
|
||||
# CDT-specific (C/C++ Development Tooling)
|
||||
.cproject
|
||||
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
|
||||
# Java annotation processor (APT)
|
||||
.factorypath
|
||||
|
||||
# PDT-specific (PHP Development Tools)
|
||||
.buildpath
|
||||
|
||||
# sbteclipse plugin
|
||||
.target
|
||||
|
||||
# Tern plugin
|
||||
.tern-project
|
||||
|
||||
# TeXlipse plugin
|
||||
.texlipse
|
||||
|
||||
# STS (Spring Tool Suite)
|
||||
.springBeans
|
||||
|
||||
# Code Recommenders
|
||||
.recommenders/
|
||||
|
||||
|
||||
### Vim ###
|
||||
# swap
|
||||
[._]*.s[a-w][a-z]
|
||||
[._]s[a-w][a-z]
|
||||
# session
|
||||
Session.vim
|
||||
# temporary
|
||||
.netrwhist
|
||||
*~
|
||||
# auto-generated tag files
|
||||
tags
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
<entry name="!?*.aj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
@ -1,3 +0,0 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="" />
|
||||
</component>
|
||||
@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="MavenImportPreferences">
|
||||
<option name="generalSettings">
|
||||
<MavenGeneralSettings>
|
||||
<option name="mavenHome" value="Bundled (Maven 3)" />
|
||||
</MavenGeneralSettings>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
<OptionsSetting value="true" id="Checkout" />
|
||||
<OptionsSetting value="true" id="Update" />
|
||||
<OptionsSetting value="true" id="Status" />
|
||||
<OptionsSetting value="true" id="Edit" />
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Groovy.iml" filepath="$PROJECT_DIR$/Groovy.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Current Groovy (sdkman)" level="application" />
|
||||
</component>
|
||||
</module>
|
||||
@ -1,17 +0,0 @@
|
||||
Welcome to the Groovy Gilded Rose
|
||||
=================================
|
||||
|
||||
to run the test, you can either:
|
||||
- run them from your favorite IDE
|
||||
- make sure you have installed language support for Groovy
|
||||
- IntelliJ:
|
||||
- open project
|
||||
- choose this folder (Groovy)
|
||||
- Eclipse:
|
||||
- new Groovy Project
|
||||
- choose this folder (Groovy) as the project folder
|
||||
- add JUnit to build path
|
||||
- run the test from the src/ folder in your shell:
|
||||
- $ cd src/
|
||||
- $ groovy com/gildedrose/GildedRoseTest.groovy
|
||||
|
||||
@ -1,62 +0,0 @@
|
||||
package com.gildedrose
|
||||
|
||||
class GildedRose {
|
||||
Item[] items
|
||||
|
||||
GildedRose(Item[] items) {
|
||||
this.items = items
|
||||
}
|
||||
|
||||
void updateQuality() {
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
if (!items[i].name.equals("Aged Brie")
|
||||
&& !items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
if (items[i].quality > 0) {
|
||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||
items[i].quality = items[i].quality - 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (items[i].quality < 50) {
|
||||
items[i].quality = items[i].quality + 1
|
||||
|
||||
if (items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
if (items[i].sellIn < 11) {
|
||||
if (items[i].quality < 50) {
|
||||
items[i].quality = items[i].quality + 1
|
||||
}
|
||||
}
|
||||
|
||||
if (items[i].sellIn < 6) {
|
||||
if (items[i].quality < 50) {
|
||||
items[i].quality = items[i].quality + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||
items[i].sellIn = items[i].sellIn - 1
|
||||
}
|
||||
|
||||
if (items[i].sellIn < 0) {
|
||||
if (!items[i].name.equals("Aged Brie")) {
|
||||
if (!items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
if (items[i].quality > 0) {
|
||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||
items[i].quality = items[i].quality - 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
items[i].quality = items[i].quality - items[i].quality
|
||||
}
|
||||
} else {
|
||||
if (items[i].quality < 50) {
|
||||
items[i].quality = items[i].quality + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package com.gildedrose
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
class GildedRoseTest {
|
||||
|
||||
@Test
|
||||
void "foo"() {
|
||||
def items = [ new Item("foo", 0, 0) ] as Item[]
|
||||
def app = new GildedRose(items)
|
||||
app.updateQuality()
|
||||
assert "fixme" == app.items[0].name
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
package com.gildedrose
|
||||
|
||||
class Item {
|
||||
|
||||
String name
|
||||
|
||||
int sellIn
|
||||
|
||||
int quality
|
||||
|
||||
Item(String name, int sellIn, int quality) {
|
||||
this.name = name
|
||||
this.sellIn = sellIn
|
||||
this.quality = quality
|
||||
}
|
||||
|
||||
@Override
|
||||
String toString() {
|
||||
return this.name + ", " + this.sellIn + ", " + this.quality
|
||||
}
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
package com.gildedrose
|
||||
|
||||
println("OMGHAI!")
|
||||
|
||||
Item[] items = [
|
||||
new Item("+5 Dexterity Vest", 10, 20),
|
||||
new Item("Aged Brie", 2, 0),
|
||||
new Item("Elixir of the Mongoose", 5, 7),
|
||||
new Item("Sulfuras, Hand of Ragnaros", 0, 80),
|
||||
new Item("Sulfuras, Hand of Ragnaros", -1, 80),
|
||||
new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20),
|
||||
new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
|
||||
new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
|
||||
// this conjured item does not work properly yet
|
||||
new Item("Conjured Mana Cake", 3, 6)] as Item[]
|
||||
|
||||
GildedRose app = new GildedRose(items)
|
||||
|
||||
int days = 2
|
||||
if (args.length > 0) {
|
||||
days = Integer.parseInt(args[0]) + 1
|
||||
}
|
||||
|
||||
for (int i = 0; i < days; i++) {
|
||||
println("-------- day " + i + " --------")
|
||||
println("name, sellIn, quality")
|
||||
for (Item item in items) {
|
||||
println(item)
|
||||
}
|
||||
println ""
|
||||
app.updateQuality()
|
||||
}
|
||||
18
R/.project
18
R/.project
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>GildedRose.R</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>de.walware.statet.r.builders.RSupport</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>de.walware.statet.base.StatetNature</nature>
|
||||
<nature>de.walware.statet.r.RNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@ -1,56 +0,0 @@
|
||||
source('item.R')
|
||||
|
||||
update_quality <- function(items) {
|
||||
lapply(items,
|
||||
function(item) {
|
||||
|
||||
if (item$name != "Aged Brie" && item$name != "Backstage passes to a TAFKAL80ETC concert") {
|
||||
if (item$quality > 0) {
|
||||
if (item$name != "Sulfuras, Hand of Ragnaros") {
|
||||
item$quality <- item$quality - 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (item$quality < 50) {
|
||||
item$quality <- item$quality + 1
|
||||
if (item$name == "Backstage passes to a TAFKAL80ETC concert") {
|
||||
if (item$sell_in < 11) {
|
||||
if (item$quality < 50) {
|
||||
item$quality = item$quality + 1
|
||||
}
|
||||
}
|
||||
if (item$sell_in < 6) {
|
||||
if (item$quality < 50) {
|
||||
item$quality = item$quality + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (item$name != "Sulfuras, Hand of Ragnaros") {
|
||||
item$sell_in <- item$sell_in - 1
|
||||
}
|
||||
|
||||
if (item$sell_in < 0) {
|
||||
if (item$name != "Aged Brie") {
|
||||
if (item$name != "Backstage passes to a TAFKAL80ETC concert") {
|
||||
if (item$quality > 0) {
|
||||
if (item$name != "Sulfuras, Hand of Ragnaros") {
|
||||
item$quality <- item$quality - 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
item$quality <- item$quality - item$quality
|
||||
}
|
||||
} else {
|
||||
if (item$quality < 50) {
|
||||
item$quality <- item$quality + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
item
|
||||
}
|
||||
)
|
||||
}
|
||||
13
R/item.R
13
R/item.R
@ -1,13 +0,0 @@
|
||||
item <- function(name, sell_in, quality) {
|
||||
newItem <- list(name=name, sell_in=sell_in, quality=quality)
|
||||
class(newItem) <- 'item'
|
||||
newItem
|
||||
}
|
||||
|
||||
as.character.item <- function(item) {
|
||||
paste(item$name, ", ", item$sell_in, ", ", item$quality, sep='')
|
||||
}
|
||||
|
||||
print.item <- function(item) {
|
||||
print.default(as.character(item))
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
source('gilded_rose.R')
|
||||
|
||||
test.foo <- function() {
|
||||
items <- list( item('foo', 0, 0) )
|
||||
items <- update_quality(items)
|
||||
checkEquals('fixme', items[[1]]$name);
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
# A little helper script to get the testing infrastructure started
|
||||
|
||||
# install.packages("RUnit")
|
||||
require(RUnit)
|
||||
|
||||
# execute single test file
|
||||
runTestFile("runit_gilded_rose.R")
|
||||
@ -1,33 +0,0 @@
|
||||
rm(list=ls())
|
||||
|
||||
source('gilded_rose.R')
|
||||
|
||||
writeLines('OMGHAI!')
|
||||
|
||||
items <- list(
|
||||
item('+5 Dexterity Vest', 10, 20),
|
||||
item('Aged Brie', 2, 0),
|
||||
item('Elixir of the Mongoose', 5, 7),
|
||||
item('Sulfuras, Hand of Ragnaros', 0, 80),
|
||||
item('Sulfuras, Hand of Ragnaros', -1, 80),
|
||||
item('Backstage passes to a TAFKAL80ETC concert', 15, 20),
|
||||
item('Backstage passes to a TAFKAL80ETC concert', 10, 49),
|
||||
item('Backstage passes to a TAFKAL80ETC concert', 5, 49),
|
||||
# This Conjured item does not work properly yet
|
||||
item('Conjured Mana Cake', 3, 6)
|
||||
)
|
||||
|
||||
days <- 2
|
||||
for (day in 0:days) {
|
||||
writeLines(paste('-------- day ', day, ' --------', sep=''))
|
||||
writeLines('name, sellIn, quality')
|
||||
lapply(items,
|
||||
function(item) {
|
||||
writeLines(as.character(item))
|
||||
}
|
||||
)
|
||||
writeLines('')
|
||||
items <- update_quality(items)
|
||||
}
|
||||
|
||||
rm('day', 'days', 'items')
|
||||
@ -1,160 +0,0 @@
|
||||
Object subclass: #GildedRose
|
||||
instanceVariableNames: ''
|
||||
classVariableNames: ''
|
||||
poolDictionaries: ''
|
||||
category: 'GildedRose'!
|
||||
!GildedRose commentStamp: 'AndreasLeidig 4/21/2012 15:38' prior: 0!
|
||||
This Kata was originally created by Terry Hughes (http://twitter.com/#!!/TerryHughes). It is already on GitHub as "GildedRose", a sample project for C#. I could have forked it again, but I thought other language users might not want to download a whole C# project environment. In this repository are starting code samples for Java, Python, Ruby, C# and C++.
|
||||
|
||||
See also http://iamnotmyself.com/2011/02/13/refactor-this-the-gilded-rose-kata/
|
||||
|
||||
====================
|
||||
How to use this Kata
|
||||
====================
|
||||
|
||||
The simplest way is to just clone the code and start hacking away improving the design. You'll want to look at the "Gilded Rose Background Reading" (below) which explains what the code is for. I strongly advise you that you'll also need some tests if you want to make sure you don't break the code while you refactor.
|
||||
|
||||
You could write some unit tests yourself, using the Kata Background Reading (below) to identify suitable test cases. I've provided a failing unit test in a popular test framework as a starting point for most languages.
|
||||
|
||||
Alternatively, use the "Text-Based" tests provided in this repository. (Read more about that in the next section)
|
||||
|
||||
Whichever testing approach you choose, the idea of the exercise is to do some deliberate practice, and improve your Refactoring skills. The idea is not to re-write the code from scratch, but rather to practice taking small steps, running the tests often, and incrementally improving the design.
|
||||
|
||||
==================
|
||||
Text-Based Testing
|
||||
==================
|
||||
|
||||
This is a testing approach which is very useful when refactoring legacy code. The basic idea is to create tests that use the text which the code produces. Before you change the code, you run it, and save the output as a "Golden Copy". Then after you change the code, you run it again, and compare the output against the Golden Copy. Any differences, and the test fails.
|
||||
|
||||
It's basically the same idea as "assertEquals(expected, actual)" in a unit test, except the text you are comparing is typically much longer, and the "expected" value is saved from actual output, rather than being defined in advance.
|
||||
|
||||
Typically a piece of legacy code may not produce suitable textual output from the start, so you may need to modify it before you can write your first text-based test. That could involve inserting log statements into the code, or just writing a "main" method that executes the code and prints out what the result is afterwards. It's this latter approach we are using here to test GildedRose.
|
||||
|
||||
The Text-Based tests in this repository are designed to be used with the tool "TextTest" (http://texttest.org). This tool helps you to organize and run text-based tests. There is more information in the README file in the "texttests" subdirectory.
|
||||
|
||||
===================================
|
||||
Gilded Rose Kata Background Reading
|
||||
===================================
|
||||
|
||||
Hi and welcome to team Gilded Rose. As you know, we are a small inn with a prime location in a prominent city ran by a friendly innkeeper named Allison. We also buy and sell only the finest goods. Unfortunately, our goods are constantly degrading in quality as they approach their sell by date. We have a system in place that updates our inventory for us. It was developed by a no-nonsense type named Leeroy, who has moved on to new adventures. Your task is to add the new feature to our system so that we can begin selling a new category of items. First an introduction to our system:
|
||||
|
||||
- All items have a SellIn value which denotes the number of days we have to sell the item
|
||||
- All items have a Quality value which denotes how valuable the item is
|
||||
- At the end of each day our system lowers both values for every item
|
||||
|
||||
Pretty simple, right? Well this is where it gets interesting:
|
||||
|
||||
- Once the sell by date has passed, Quality degrades twice as fast
|
||||
- The Quality of an item is never negative
|
||||
- "Aged Brie" actually increases in Quality the older it gets
|
||||
- The Quality of an item is never more than 50
|
||||
- "Sulfuras", being a legendary item, never has to be sold or decreases in Quality
|
||||
- "Backstage passes", like aged brie, increases in Quality as it's SellIn value approaches; Quality increases by 2 when there are 10 days or less and by 3 when there are 5 days or less but Quality drops to 0 after the concert
|
||||
|
||||
We have recently signed a supplier of conjured items. This requires an update to our system:
|
||||
|
||||
- "Conjured" items degrade in Quality twice as fast as normal items
|
||||
|
||||
Feel free to make any changes to the UpdateQuality method and add any new code as long as everything still works correctly. However, do not alter the Item class or Items property as those belong to the goblin in the corner who will insta-rage and one-shot you as he doesn't believe in shared code ownership (you can make the UpdateQuality method and Items property static if you like, we'll cover for you).
|
||||
|
||||
Just for clarification, an item can never have its Quality increase above 50, however "Sulfuras" is a legendary item and as such its Quality is 80 and it never alters.!
|
||||
|
||||
|
||||
!GildedRose methodsFor: 'API' stamp: 'AndreasLeidig 4/21/2012 17:02'!
|
||||
updateQualityFor: items
|
||||
items
|
||||
do: [:item |
|
||||
(item name ~= 'Aged Brie'
|
||||
and: [item name ~= 'Backstage passes to a TAFKAL80ETC concert'])
|
||||
ifTrue: [item quality > 0
|
||||
ifTrue: [item name ~= 'Sulfuras, Hand of Ragnaros'
|
||||
ifTrue: [item quality: item quality - 1]]]
|
||||
ifFalse: [item quality < 50
|
||||
ifTrue: [item quality: item quality + 1.
|
||||
item name = 'Backstage passes to a TAFKAL80ETC concert'
|
||||
ifTrue: [item sellIn < 11
|
||||
ifTrue: [item quality < 50
|
||||
ifTrue: [item quality: item quality + 1]].
|
||||
item sellIn < 6
|
||||
ifTrue: [item quality < 50
|
||||
ifTrue: [item quality: item quality + 1]]]]].
|
||||
item name ~= 'Sulfuras, Hand of Ragnaros'
|
||||
ifTrue: [item sellIn: item sellIn - 1].
|
||||
item sellIn < 0
|
||||
ifTrue: [item name ~= 'Aged Brie'
|
||||
ifTrue: [item name ~= 'Backstage passes to a TAFKAL80ETC concert'
|
||||
ifTrue: [item quality > 0
|
||||
ifTrue: [item name ~= 'Sulfuras, Hand of Ragnaros'
|
||||
ifTrue: [item quality: item quality - 1]]]
|
||||
ifFalse: [item quality: item quality - item quality]]
|
||||
ifFalse: [item quality < 50
|
||||
ifTrue: [item quality: item quality + 1]]]]! !
|
||||
|
||||
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
|
||||
|
||||
GildedRose class
|
||||
instanceVariableNames: ''!
|
||||
|
||||
!GildedRose class methodsFor: 'run Example' stamp: 'AndreasLeidig 4/21/2012 20:26'!
|
||||
runExamples
|
||||
"GildedRose runExamples"
|
||||
| items gildedRose |
|
||||
items := OrderedCollection new
|
||||
add: (Item new name: '+5 Dexterity Vest'; sellIn: 10; quality: 20; yourself);
|
||||
add: (Item new name: 'Aged Brie'; sellIn: 2; quality: 0; yourself);
|
||||
add: (Item new name: 'Elixir of the Mongoose'; sellIn: 5; quality: 7; yourself);
|
||||
add: (Item new name: 'Sulfuras, Hand of Ragnaros'; sellIn: 0; quality: 80; yourself);
|
||||
add: (Item new name: 'Sulfuras, Hand of Ragnaros'; sellIn: -1; quality: 80; yourself);
|
||||
add: (Item new name: 'Backstage passes to a TAFKAL80ETC concert'; sellIn: 15; quality: 20; yourself);
|
||||
add: (Item new name: 'Backstage passes to a TAFKAL80ETC concert'; sellIn: 10; quality: 49; yourself);
|
||||
add: (Item new name: 'Backstage passes to a TAFKAL80ETC concert'; sellIn: 5; quality: 49; yourself);
|
||||
add: (Item new name: 'Conjured Mana Cake'; sellIn: 3; quality: 6; yourself); "this conjured item does not work properly yet"
|
||||
yourself.
|
||||
|
||||
gildedRose := GildedRose new.
|
||||
Transcript show: 'OMGHAI!!';
|
||||
cr.
|
||||
0 to: 30 do: [:idx |
|
||||
Transcript show: '-------- day ' , idx printString , ' --------';
|
||||
cr;
|
||||
show: 'name, sellIn, quality';
|
||||
cr.
|
||||
items
|
||||
do: [:item |
|
||||
Transcript show: item name , ', ' , item sellIn printString , ', ' , item quality printString;
|
||||
cr].
|
||||
Transcript cr.
|
||||
gildedRose updateQualityFor: items].
|
||||
Transcript cr! !
|
||||
|
||||
|
||||
Object subclass: #Item
|
||||
instanceVariableNames: 'name sellIn quality'
|
||||
classVariableNames: ''
|
||||
poolDictionaries: ''
|
||||
category: 'GildedRose'!
|
||||
|
||||
!Item methodsFor: 'accessing' stamp: 'AndreasLeidig 4/21/2012 15:40'!
|
||||
name
|
||||
^name! !
|
||||
|
||||
!Item methodsFor: 'accessing' stamp: 'AndreasLeidig 4/21/2012 15:41'!
|
||||
name: aString
|
||||
name := aString! !
|
||||
|
||||
!Item methodsFor: 'accessing' stamp: 'AndreasLeidig 4/21/2012 15:41'!
|
||||
quality
|
||||
^quality! !
|
||||
|
||||
!Item methodsFor: 'accessing' stamp: 'AndreasLeidig 4/21/2012 15:42'!
|
||||
quality: aNumber
|
||||
quality := aNumber! !
|
||||
|
||||
!Item methodsFor: 'accessing' stamp: 'AndreasLeidig 4/21/2012 15:41'!
|
||||
sellIn
|
||||
^sellIn! !
|
||||
|
||||
!Item methodsFor: 'accessing' stamp: 'AndreasLeidig 4/21/2012 15:42'!
|
||||
sellIn: aNumber
|
||||
sellIn := aNumber
|
||||
! !
|
||||
10
TypeScript/.gitignore
vendored
10
TypeScript/.gitignore
vendored
@ -1,10 +0,0 @@
|
||||
.DS_Store
|
||||
.idea
|
||||
node_modules
|
||||
typings
|
||||
app/**/*.js
|
||||
app/**/*.js.map
|
||||
test/**/*.js
|
||||
test/**/*.js.map
|
||||
coverage
|
||||
.nyc_output
|
||||
@ -1,69 +0,0 @@
|
||||
export class Item {
|
||||
name: string;
|
||||
sellIn: number;
|
||||
quality: number;
|
||||
|
||||
constructor(name, sellIn, quality) {
|
||||
this.name = name;
|
||||
this.sellIn = sellIn;
|
||||
this.quality = quality;
|
||||
}
|
||||
}
|
||||
|
||||
export class GildedRose {
|
||||
items: Array<Item>;
|
||||
|
||||
constructor(items = [] as Array<Item>) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
updateQuality() {
|
||||
for (let i = 0; i < this.items.length; i++) {
|
||||
if (this.items[i].name != 'Aged Brie' && this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if (this.items[i].quality > 0) {
|
||||
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
||||
this.items[i].quality = this.items[i].quality - 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.items[i].quality < 50) {
|
||||
this.items[i].quality = this.items[i].quality + 1
|
||||
if (this.items[i].name == 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if (this.items[i].sellIn < 11) {
|
||||
if (this.items[i].quality < 50) {
|
||||
this.items[i].quality = this.items[i].quality + 1
|
||||
}
|
||||
}
|
||||
if (this.items[i].sellIn < 6) {
|
||||
if (this.items[i].quality < 50) {
|
||||
this.items[i].quality = this.items[i].quality + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
||||
this.items[i].sellIn = this.items[i].sellIn - 1;
|
||||
}
|
||||
if (this.items[i].sellIn < 0) {
|
||||
if (this.items[i].name != 'Aged Brie') {
|
||||
if (this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if (this.items[i].quality > 0) {
|
||||
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
||||
this.items[i].quality = this.items[i].quality - 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.items[i].quality = this.items[i].quality - this.items[i].quality
|
||||
}
|
||||
} else {
|
||||
if (this.items[i].quality < 50) {
|
||||
this.items[i].quality = this.items[i].quality + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this.items;
|
||||
}
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
{
|
||||
"name": "gilded-rose-kata",
|
||||
"version": "1.0.0",
|
||||
"description": "Gilded Rose kata in TypeScript",
|
||||
"scripts": {
|
||||
"precompile": "rimraf app/**/*.js test/**/*.js",
|
||||
"compile": "tsc",
|
||||
"pretest": "rimraf app/**/*.js test/**/*.js",
|
||||
"test": "nyc mocha"
|
||||
},
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@types/chai": "~3.5.2",
|
||||
"@types/mocha": "~2.2.41",
|
||||
"@types/node": "~7.0.18",
|
||||
"chai": "~3.5.0",
|
||||
"mocha": "~3.2.0",
|
||||
"nyc": "~11.0.3",
|
||||
"rimraf": "~2.5.2",
|
||||
"source-map-support": "0.5.9",
|
||||
"ts-node": "~3.1.0",
|
||||
"typescript": "~3.0.3"
|
||||
},
|
||||
"nyc": {
|
||||
"extension": [
|
||||
".ts"
|
||||
],
|
||||
"exclude": [
|
||||
"**/*.d.ts",
|
||||
"test/**"
|
||||
],
|
||||
"require": [
|
||||
"ts-node/register"
|
||||
],
|
||||
"reporter": [
|
||||
"html",
|
||||
"text"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
import { expect } from 'chai';
|
||||
import { Item, GildedRose } from '../app/gilded-rose';
|
||||
|
||||
describe('Gilded Rose', function () {
|
||||
|
||||
it('should foo', function() {
|
||||
const gildedRose = new GildedRose([ new Item('foo', 0, 0) ]);
|
||||
const items = gildedRose.updateQuality();
|
||||
expect(items[0].name).to.equal('fixme');
|
||||
});
|
||||
|
||||
});
|
||||
@ -1,27 +0,0 @@
|
||||
import { Item, GildedRose } from '../app/gilded-rose';
|
||||
|
||||
const items = [
|
||||
new Item("+5 Dexterity Vest", 10, 20), //
|
||||
new Item("Aged Brie", 2, 0), //
|
||||
new Item("Elixir of the Mongoose", 5, 7), //
|
||||
new Item("Sulfuras, Hand of Ragnaros", 0, 80), //
|
||||
new Item("Sulfuras, Hand of Ragnaros", -1, 80),
|
||||
new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20),
|
||||
new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
|
||||
new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
|
||||
// this conjured item does not work properly yet
|
||||
new Item("Conjured Mana Cake", 3, 6)];
|
||||
|
||||
|
||||
const gildedRose = new GildedRose(items);
|
||||
var days: number = 2;
|
||||
for (let i = 0; i < days; i++) {
|
||||
console.log("-------- day " + i + " --------");
|
||||
console.log("name, sellIn, quality");
|
||||
items.forEach(element => {
|
||||
console.log(element.name + ' ' + element.sellIn + ' ' + element.quality);
|
||||
|
||||
});
|
||||
console.log();
|
||||
gildedRose.updateQuality();
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
--compilers ts-node/register
|
||||
--require source-map-support/register
|
||||
--recursive
|
||||
test/**/*.spec.ts
|
||||
@ -1,12 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"strict": true,
|
||||
"noImplicitAny": false,
|
||||
"sourceMap": false
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
# Gilded Rose Refactoring Kata in [ABAP](http://scn.sap.com/community/abap/)
|
||||
|
||||
## Prerequisite
|
||||
|
||||
Access to SAP NetWeaver server with at least ABAP 7.40
|
||||
|
||||
## Installation
|
||||
|
||||
Assuming you have a proper developer key set up, run SE38
|
||||
* create a new Module Pool (type M) program as a Local Object
|
||||
* paste the raw code from [YY_PAO_GILDED_ROSE.abap](https://raw.githubusercontent.com/brehberg/GildedRose-Refactoring-Kata/master/abap/YY_PAO_GILDED_ROSE.abap)
|
||||
* save (Ctrl-S) and activate (Ctrl-F3) the program
|
||||
|
||||
## Running Tests
|
||||
|
||||
From the menus choose Program -> Execute -> Unit Tests (Ctrl+Shift+F10)
|
||||
@ -1,242 +0,0 @@
|
||||
*&---------------------------------------------------------------------*
|
||||
*& Gilded Rose Requirements Specification
|
||||
*&---------------------------------------------------------------------*
|
||||
*&
|
||||
*& Hi and welcome to team Gilded Rose. As you know, we are a small inn with
|
||||
*& a prime location in a prominent city ran by a friendly innkeeper named
|
||||
*& Allison. We also buy and sell only the finest goods. Unfortunately, our
|
||||
*& goods are constantly degrading in quality as they approach their sell by
|
||||
*& date. We have a system in place that updates our inventory for us. It
|
||||
*& was developed by a no-nonsense type named Leeroy, who has moved on to
|
||||
*& new adventures. Your task is to add the new feature to our system so that
|
||||
*& we can begin selling a new category of items.
|
||||
*&
|
||||
*& First an introduction to our system:
|
||||
*&
|
||||
*& - All items have a Sell In value which denotes the number of
|
||||
*& days we have to sell the item
|
||||
*& - All items have a Quality value which denotes how valuable the item is
|
||||
*& - At the end of each day our system lowers both values for every item
|
||||
*&
|
||||
*& Seems pretty simple, right? Well this is where it gets interesting:
|
||||
*&
|
||||
*& - Once the sell by date has passed, Quality degrades twice as fast
|
||||
*& - The Quality of an item is never negative
|
||||
*& - "Aged Brie" actually increases in Quality the older it gets
|
||||
*& - The Quality of an item is never more than 50
|
||||
*& - "Sulfuras", being a legendary item, never has to be sold or
|
||||
*& decreases in Quality
|
||||
*& - "Backstage passes", like aged brie, increases in Quality as its
|
||||
*& Sell In value approaches; Quality increases by 2 when there
|
||||
*& are 10 days or less and by 3 when there are 5 days or less
|
||||
*& but Quality drops to 0 after the concert
|
||||
*&
|
||||
*& We have recently signed a supplier of conjured items. This requires an
|
||||
*& update to our system:
|
||||
*&
|
||||
*& - "Conjured" items degrade in Quality twice as fast as normal items
|
||||
*&
|
||||
*& Feel free to make any changes to the Update Quality method and add any new
|
||||
*& code as long as everything still works correctly. However, do not alter
|
||||
*& the Item class directly or Items table attribute as those belong to the
|
||||
*& goblin in the corner who will insta-rage and one-shot you as he doesn't
|
||||
*& believe in shared code ownership (you can make the Update Quality method
|
||||
*& and Items property static if you must, we'll cover for you).
|
||||
*&
|
||||
*& Just for clarification, an item can never have its Quality increase
|
||||
*& above 50, however "Sulfuras" is a legendary item and as such its Quality
|
||||
*& is 80 and it never alters.
|
||||
|
||||
PROGRAM yy_pao_gilded_rose.
|
||||
|
||||
|
||||
*& Production Code - Class Library
|
||||
CLASS lcl_item DEFINITION DEFERRED.
|
||||
|
||||
CLASS lcl_gilded_rose DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
TYPES:
|
||||
tt_items TYPE STANDARD TABLE OF REF TO lcl_item WITH EMPTY KEY.
|
||||
METHODS:
|
||||
constructor
|
||||
IMPORTING it_items TYPE tt_items,
|
||||
update_quality.
|
||||
|
||||
PRIVATE SECTION.
|
||||
DATA:
|
||||
mt_items TYPE tt_items.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_item DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
METHODS:
|
||||
constructor
|
||||
IMPORTING iv_name TYPE string
|
||||
iv_sell_in TYPE i
|
||||
iv_quality TYPE i,
|
||||
description
|
||||
RETURNING VALUE(rv_string) TYPE string.
|
||||
DATA:
|
||||
mv_name TYPE string,
|
||||
mv_sell_in TYPE i,
|
||||
mv_quality TYPE i.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_gilded_rose IMPLEMENTATION.
|
||||
|
||||
METHOD constructor.
|
||||
mt_items = it_items.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD update_quality.
|
||||
|
||||
LOOP AT mt_items INTO DATA(lo_item).
|
||||
IF lo_item->mv_name <> |Aged Brie| AND
|
||||
lo_item->mv_name <> |Backstage passes to a TAFKAL80ETC concert|.
|
||||
IF lo_item->mv_quality > 0.
|
||||
IF lo_item->mv_name <> |Sulfuras, Hand of Ragnaros|.
|
||||
lo_item->mv_quality = lo_item->mv_quality - 1.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ELSE.
|
||||
IF lo_item->mv_quality < 50.
|
||||
lo_item->mv_quality = lo_item->mv_quality + 1.
|
||||
|
||||
IF lo_item->mv_name = |Backstage passes to a TAFKAL80ETC concert|.
|
||||
IF lo_item->mv_sell_in < 11.
|
||||
IF lo_item->mv_quality < 50.
|
||||
lo_item->mv_quality = lo_item->mv_quality + 1.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
IF lo_item->mv_sell_in < 6.
|
||||
IF lo_item->mv_quality < 50.
|
||||
lo_item->mv_quality = lo_item->mv_quality + 1.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
IF lo_item->mv_name <> |Sulfuras, Hand of Ragnaros|.
|
||||
lo_item->mv_sell_in = lo_item->mv_sell_in - 1.
|
||||
ENDIF.
|
||||
|
||||
IF lo_item->mv_sell_in < 0.
|
||||
IF lo_item->mv_name <> |Aged Brie|.
|
||||
IF lo_item->mv_name <> |Backstage passes to a TAFKAL80ETC concert|.
|
||||
IF lo_item->mv_quality > 0.
|
||||
IF lo_item->mv_name <> |Sulfuras, Hand of Ragnaros|.
|
||||
lo_item->mv_quality = lo_item->mv_quality - 1.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ELSE.
|
||||
lo_item->mv_quality = lo_item->mv_quality - lo_item->mv_quality.
|
||||
ENDIF.
|
||||
ELSE.
|
||||
IF lo_item->mv_quality < 50.
|
||||
lo_item->mv_quality = lo_item->mv_quality + 1.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_item IMPLEMENTATION.
|
||||
|
||||
METHOD constructor.
|
||||
mv_name = iv_name.
|
||||
mv_sell_in = iv_sell_in.
|
||||
mv_quality = iv_quality.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD description.
|
||||
rv_string = |{ mv_name }, { mv_sell_in }, { mv_quality }|.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
*& Test Code - Executable Text Test Fixture
|
||||
CLASS lth_texttest_fixture DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
CLASS-METHODS main.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lth_texttest_fixture IMPLEMENTATION.
|
||||
METHOD main.
|
||||
DATA(lo_out) = cl_demo_output=>new( )->write_text( |OMGHAI!| ).
|
||||
|
||||
DATA(lt_items) = VALUE lcl_gilded_rose=>tt_items(
|
||||
( NEW #( iv_name = |+5 Dexterity Vest|
|
||||
iv_sell_in = 10
|
||||
iv_quality = 20 ) )
|
||||
( NEW #( iv_name = |Aged Brie|
|
||||
iv_sell_in = 2
|
||||
iv_quality = 0 ) )
|
||||
( NEW #( iv_name = |Elixir of the Mongoose|
|
||||
iv_sell_in = 5
|
||||
iv_quality = 7 ) )
|
||||
( NEW #( iv_name = |Sulfuras, Hand of Ragnaros|
|
||||
iv_sell_in = 0
|
||||
iv_quality = 80 ) )
|
||||
( NEW #( iv_name = |Backstage passes to a TAFKAL80ETC concert|
|
||||
iv_sell_in = 15
|
||||
iv_quality = 20 ) )
|
||||
( NEW #( iv_name = |Backstage passes to a TAFKAL80ETC concert|
|
||||
iv_sell_in = 10
|
||||
iv_quality = 49 ) )
|
||||
( NEW #( iv_name = |Backstage passes to a TAFKAL80ETC concert|
|
||||
iv_sell_in = 5
|
||||
iv_quality = 49 ) )
|
||||
"This conjured item does not work properly yet
|
||||
( NEW #( iv_name = |Conjured Mana Cake|
|
||||
iv_sell_in = 3
|
||||
iv_quality = 6 ) ) ).
|
||||
|
||||
DATA(lo_app) = NEW lcl_gilded_rose( it_items = lt_items ).
|
||||
|
||||
DATA(lv_days) = 2.
|
||||
cl_demo_input=>request( EXPORTING text = |Number of Days?|
|
||||
CHANGING field = lv_days ).
|
||||
|
||||
DO lv_days TIMES.
|
||||
lo_out->next_section( |-------- day { sy-index } --------| ).
|
||||
lo_out->write_text( |Name, Sell_In, Quality| ).
|
||||
LOOP AT lt_items INTO DATA(lo_item).
|
||||
lo_out->write_text( lo_item->description( ) ).
|
||||
ENDLOOP.
|
||||
lo_app->update_quality( ).
|
||||
ENDDO.
|
||||
|
||||
lo_out->display( ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
*& Test Code - Currently Broken
|
||||
CLASS ltc_gilded_rose DEFINITION FINAL FOR TESTING RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS:
|
||||
foo FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_gilded_rose IMPLEMENTATION.
|
||||
|
||||
METHOD foo.
|
||||
DATA(lt_items) = VALUE lcl_gilded_rose=>tt_items( ( NEW #( iv_name = |foo|
|
||||
iv_sell_in = 0
|
||||
iv_quality = 0 ) ) ).
|
||||
|
||||
DATA(lo_app) = NEW lcl_gilded_rose( it_items = lt_items ).
|
||||
lo_app->update_quality( ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = CAST lcl_item( lt_items[ 1 ] )->mv_name
|
||||
exp = |fixme| ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
@ -1,31 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.8.4)
|
||||
project(GildedRose_c99)
|
||||
|
||||
enable_testing()
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(unity
|
||||
GIT_REPOSITORY https://github.com/ThrowTheSwitch/Unity.git
|
||||
GIT_TAG master
|
||||
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/unity-src"
|
||||
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/unity-build"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/unity-src/src/unity.c
|
||||
DEPENDS unity
|
||||
COMMAND "")
|
||||
|
||||
|
||||
add_executable( GildedRose_Unity
|
||||
GildedRose.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/unity-src/src/unity.c
|
||||
test_unity_gildedrose.c
|
||||
)
|
||||
target_include_directories(GildedRose_Unity PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/unity-src/src/)
|
||||
set_property(TARGET GildedRose_Unity PROPERTY C_STANDARD 99)
|
||||
add_dependencies(GildedRose_Unity unity)
|
||||
|
||||
add_test(NAME GildedRose_Unity COMMAND GildedRose_Unity)
|
||||
@ -1,90 +0,0 @@
|
||||
#include <string.h>
|
||||
#include "GildedRose.h"
|
||||
|
||||
Item*
|
||||
init_item(Item* item, const char *name, int sellIn, int quality)
|
||||
{
|
||||
item->sellIn = sellIn;
|
||||
item->quality = quality;
|
||||
item->name = strdup(name);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
void update_quality(Item items[], int size)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
if (strcmp(items[i].name, "Aged Brie") && strcmp(items[i].name, "Backstage passes to a TAFKAL80ETC concert"))
|
||||
{
|
||||
if (items[i].quality > 0)
|
||||
{
|
||||
if (strcmp(items[i].name, "Sulfuras, Hand of Ragnaros"))
|
||||
{
|
||||
items[i].quality = items[i].quality - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
|
||||
if (!strcmp(items[i].name, "Backstage passes to a TAFKAL80ETC concert"))
|
||||
{
|
||||
if (items[i].sellIn < 11)
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (items[i].sellIn < 6)
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(items[i].name, "Sulfuras, Hand of Ragnaros"))
|
||||
{
|
||||
items[i].sellIn = items[i].sellIn - 1;
|
||||
}
|
||||
|
||||
if (items[i].sellIn < 0)
|
||||
{
|
||||
if (strcmp(items[i].name, "Aged Brie"))
|
||||
{
|
||||
if (strcmp(items[i].name, "Backstage passes to a TAFKAL80ETC concert"))
|
||||
{
|
||||
if (items[i].quality > 0)
|
||||
{
|
||||
if (strcmp(items[i].name, "Sulfuras, Hand of Ragnaros"))
|
||||
{
|
||||
items[i].quality = items[i].quality - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
items[i].quality = items[i].quality - items[i].quality;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
int sellIn;
|
||||
int quality;
|
||||
} Item;
|
||||
|
||||
extern Item* init_item(Item* item, const char *name, int sellIn, int quality);
|
||||
extern void update_quality(Item items[], int size);
|
||||
@ -1,43 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include "GildedRose.h"
|
||||
|
||||
int
|
||||
print_item(Item *item)
|
||||
{
|
||||
return printf("%s, %d, %d\n", item->name, item->sellIn, item->quality);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
Item items[9];
|
||||
int last = 0;
|
||||
int day;
|
||||
int index;
|
||||
|
||||
init_item(items + last++, "+5 Dexterity Vest", 10, 20);
|
||||
init_item(items + last++, "Aged Brie", 2, 0);
|
||||
init_item(items + last++, "Elixir of the Mongoose", 5, 7);
|
||||
init_item(items + last++, "Sulfuras, Hand of Ragnaros", 0, 80);
|
||||
init_item(items + last++, "Sulfuras, Hand of Ragnaros", -1, 80);
|
||||
init_item(items + last++, "Backstage passes to a TAFKAL80ETC concert", 15, 20);
|
||||
init_item(items + last++, "Backstage passes to a TAFKAL80ETC concert", 10, 49);
|
||||
init_item(items + last++, "Backstage passes to a TAFKAL80ETC concert", 5, 49);
|
||||
// this Conjured item doesn't yet work properly
|
||||
init_item(items + last++, "Conjured Mana Cake", 3, 6);
|
||||
|
||||
puts("OMGHAI!");
|
||||
|
||||
for (day = 0; day <= 30; day++)
|
||||
{
|
||||
printf("-------- day %d --------\n", day);
|
||||
printf("name, sellIn, quality\n");
|
||||
for(index = 0; index < last; index++) {
|
||||
print_item(items + index);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
update_quality(items, last);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
51
c99/Makefile
51
c99/Makefile
@ -1,51 +0,0 @@
|
||||
# Makefile for building the kata file with the Google Testing Framework
|
||||
#
|
||||
# SYNOPSIS:
|
||||
#
|
||||
# make [all] - makes everything, runs tests
|
||||
# make TARGET - makes the given target.
|
||||
# make clean - removes all files generated by make.
|
||||
# make memtest - run memory leak analysis
|
||||
|
||||
# The _POSIX_C_SOURCE definition prevents the compiler from throwing warnings
|
||||
CFLAGS = `pkg-config --cflags check` -g --std=c99 -D_POSIX_C_SOURCE=200809L
|
||||
LIBS = `pkg-config --libs check`
|
||||
|
||||
# All files that should be part of your test should start with 'test_'
|
||||
TEST_SRC = $(wildcard test_*.c)
|
||||
TEST_BASE = $(basename ${TEST_SRC})
|
||||
TEST_OBJECTS = $(addsuffix .o, ${TEST_BASE})
|
||||
|
||||
# All files that should be part of your main program should start with 'gilded_'
|
||||
PROG_SRC = $(wildcard gilded_*.c)
|
||||
PROG_BASE = $(basename ${PROG_SRC})
|
||||
PROG_OBJECTS = $(addsuffix .o, ${PROG_BASE})
|
||||
|
||||
OBJECT_UNDER_TEST = GildedRose.o ${PROG_OBJECTS}
|
||||
|
||||
# This is the test application. You can run this program to see your test output
|
||||
TEST_APP = test_gildedrose
|
||||
|
||||
|
||||
# This will generate output for several products over a course of several days.
|
||||
# You can run this application to build golden rule tests
|
||||
GOLDEN_APP = golden_rose
|
||||
|
||||
all: ${TEST_APP} ${GOLDEN_APP}
|
||||
./${TEST_APP}
|
||||
|
||||
${TEST_APP}: ${TEST_OBJECTS} ${OBJECT_UNDER_TEST}
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
${GOLDEN_APP}: GildedRoseTextTests.o ${OBJECT_UNDER_TEST}
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
|
||||
# If you're not on a mac, you should run memtest (in fact, consider adding it to the 'all' target).
|
||||
# If you're on a mac, complain to apple for breaking an important development tool.
|
||||
memtest: ${TEST_APP}
|
||||
valgrind --leak-check=full --error-exitcode=1 ./${TEST_APP} --nofork
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f ${TEST_APP}
|
||||
rm -f ${GOLDEN_APP}
|
||||
@ -1,41 +0,0 @@
|
||||
# Gilded Rose, C99 Edition
|
||||
|
||||
The command "make" will build and run your tests, as well as build the program
|
||||
golden_rose, which can serve as the basis for a golden-rule test.
|
||||
|
||||
|
||||
## Assumptions
|
||||
- gnu make and a C compiler (like gcc) is installed on your system and is in the PATH
|
||||
- The check unit testing library is installed on your system (https://libcheck.github.io/check/)
|
||||
- pkg-config is installed on your system
|
||||
|
||||
## Usage
|
||||
- Run `make` to build the program and run all tests
|
||||
- Files which contain tests should be named `test_*.c` They will automatically
|
||||
be included in your test suite.
|
||||
- `GildedRose.h` should not be modified. The Goblin threat is real.
|
||||
- New program logic may be included in files named `gilded_*.c` which will
|
||||
automatically be included in both your tests and the final program.
|
||||
|
||||
## Golden Rule tests
|
||||
- The program `golden_rose` will generate text output. If you capture this
|
||||
output after your first `make` you can use this as a reference for a golden
|
||||
rule test.
|
||||
- You can test your work against this reference by directing the output of your
|
||||
current golden_rose to a file and using the `diff` utility to compare that
|
||||
to the reference file you created above.
|
||||
- To avoid the Goblin threat you can use `git diff GildedRose.h`, which should
|
||||
have no output if you have left the precious Item structure unchanged.
|
||||
|
||||
## Notes
|
||||
- This project is tweaked to run on Linux systems, and will mostly work on Macs.
|
||||
With some changes to the Makefile it can be made to run on BSD systems with
|
||||
BSD make. An adventurous person could also get it to run on Windows.
|
||||
- If you are working on a Macintosh computer you cannot run the memtest target,
|
||||
because valgrind and OS X don't play nice any more. If you want to use the
|
||||
memory checker OS X does run docker as a first class citizen.
|
||||
- If you don't have pkg-config on your system, the only changes you'll need to
|
||||
make are for the requirements of the check library. Mostly you need to
|
||||
set the appropriate flags for threaded binaries, which may include some
|
||||
special linker flags. The libcheck documentation will cover what you need
|
||||
if you want to undertake this change.
|
||||
@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ ! -d build ]]; then
|
||||
mkdir -p build
|
||||
fi
|
||||
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=DEBUG && cmake --build . && ctest --output-on-failure
|
||||
@ -1,31 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <check.h>
|
||||
|
||||
Suite *suite_rose(void);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Suite *s;
|
||||
SRunner *runner;
|
||||
int number_fails;
|
||||
int forkme = 1;
|
||||
|
||||
if (argc > 1 && strcmp(argv[1], "--nofork") == 0) {
|
||||
forkme = 0;
|
||||
}
|
||||
|
||||
s = suite_rose();
|
||||
runner = srunner_create(s);
|
||||
|
||||
if (0 == forkme) {
|
||||
srunner_set_fork_status(runner, CK_NOFORK);
|
||||
}
|
||||
|
||||
srunner_run_all(runner, CK_NORMAL);
|
||||
number_fails = srunner_ntests_failed(runner);
|
||||
|
||||
srunner_free(runner);
|
||||
|
||||
return number_fails;
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
#include <check.h>
|
||||
#include "GildedRose.h"
|
||||
|
||||
|
||||
|
||||
START_TEST(roseFoo)
|
||||
{
|
||||
Item items[1];
|
||||
init_item(items, "foo", 0, 0);
|
||||
update_quality(items, 1);
|
||||
|
||||
ck_assert_str_eq("fixme", items[0].name);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
TCase *tcase_rose(void)
|
||||
{
|
||||
TCase *tc;
|
||||
|
||||
tc = tcase_create("gilded-rose");
|
||||
tcase_add_test(tc, roseFoo);
|
||||
|
||||
return tc;
|
||||
}
|
||||
|
||||
Suite *suite_rose(void)
|
||||
{
|
||||
Suite *s;
|
||||
|
||||
s = suite_create("characterization-tests");
|
||||
suite_add_tcase(s, tcase_rose());
|
||||
|
||||
return s;
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
#include "unity.h"
|
||||
#include "GildedRose.h"
|
||||
|
||||
void test_NameOfItem(void)
|
||||
{
|
||||
Item items[1];
|
||||
init_item(items, "Foo", 0, 0);
|
||||
update_quality(items, 1);
|
||||
TEST_ASSERT_EQUAL_STRING( "fixme", items[0].name );
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
RUN_TEST(test_NameOfItem);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
||||
@ -1,140 +0,0 @@
|
||||
; Hi and welcome to team Gilded Rose. As you know, we are a small inn
|
||||
; with a prime location in a prominent city ran by a friendly
|
||||
; innkeeper named Allison. We also buy and sell only the finest goods.
|
||||
; Unfortunately, our goods are constantly degrading in quality as they
|
||||
; approach their sell by date. We have a system in place that updates
|
||||
; our inventory for us. It was developed by a no-nonsense type named
|
||||
; Leeroy, who has moved on to new adventures. Your task is to add the
|
||||
; new feature to our system so that we can begin selling a new
|
||||
; category of items.
|
||||
; First an introduction to our system:
|
||||
; All items have a SellIn value which denotes the number of days we have to sell the item
|
||||
; All items have a Quality value which denotes how valuable the item is
|
||||
; At the end of each day our system lowers both values for every item
|
||||
; Pretty simple, right? Well this is where it gets interesting:
|
||||
; Once the sell by date has passed, Quality degrades twice as fast
|
||||
; The Quality of an item is never negative
|
||||
; "Aged Brie" actually increases in Quality the older it gets
|
||||
; The Quality of an item is never more than 50
|
||||
; "Sulfuras", being a legendary item, never has to be sold or decreases in Quality
|
||||
; "Backstage passes", like aged brie, increases in Quality as it's
|
||||
; SellIn value approaches; Quality increases by 2 when there are 10
|
||||
; days or less and by 3 when there are 5 days or less but Quality
|
||||
; drops to 0 after the concert
|
||||
; We have recently signed a supplier of conjured items. This requires an update to our system:
|
||||
; "Conjured" items degrade in Quality twice as fast as normal items
|
||||
; Feel free to make any changes to the UpdateQuality method and add
|
||||
; any new code as long as everything still works correctly. However,
|
||||
; do not alter the Item class or Items property as those belong to the
|
||||
; goblin in the corner who will insta-rage and one-shot you as he
|
||||
; doesn't believe in shared code ownership (you can make the
|
||||
; UpdateQuality method and Items property static if you like, we'll
|
||||
; cover for you).
|
||||
; Just for clarification, an item can never have its Quality increase
|
||||
; above 50, however "Sulfuras" is a legendary item and as such its
|
||||
; Quality is 80 and it never alters.
|
||||
|
||||
; https://github.com/emilybache/GildedRose-Refactoring-Kata
|
||||
|
||||
; Common Lisp version: Rainer Joswig, joswig@lisp.de, 2016
|
||||
|
||||
; Example from the command line:
|
||||
; sbcl --script gildedrose.lisp 10
|
||||
|
||||
;;; ================================================================
|
||||
;;; Code
|
||||
|
||||
(defpackage "GILDED-ROSE"
|
||||
(:use "CL"))
|
||||
|
||||
(in-package "GILDED-ROSE")
|
||||
|
||||
|
||||
;;; Class ITEM
|
||||
|
||||
(defclass item ()
|
||||
((name :initarg :name :type string)
|
||||
(sell-in :initarg :sell-in :type integer)
|
||||
(quality :initarg :quality :type integer)))
|
||||
|
||||
(defmethod to-string ((i item))
|
||||
(with-slots (name quality sell-in) i
|
||||
(format nil "~a, ~a, ~a" name sell-in quality)))
|
||||
|
||||
;;; Class GILDED-ROSE
|
||||
|
||||
(defclass gilded-rose ()
|
||||
((items :initarg :items)))
|
||||
|
||||
(defmethod update-quality ((gr gilded-rose))
|
||||
(with-slots (items) gr
|
||||
(dotimes (i (length items))
|
||||
(with-slots (name quality sell-in)
|
||||
(elt items i)
|
||||
(if (and (not (equalp name "Aged Brie"))
|
||||
(not (equalp name "Backstage passes to a TAFKAL80ETC concert")))
|
||||
(if (> quality 0)
|
||||
(if (not (equalp name "Sulfuras, Hand of Ragnaros"))
|
||||
(setf quality (- quality 1))))
|
||||
(when (< quality 50)
|
||||
(setf quality (+ quality 1))
|
||||
(when (equalp name "Backstage passes to a TAFKAL80ETC concert")
|
||||
(if (< sell-in 11)
|
||||
(if (< quality 50)
|
||||
(setf quality (+ quality 1))))
|
||||
(if (< sell-in 6)
|
||||
(if (< quality 50)
|
||||
(setf quality (+ quality 1)))))))
|
||||
|
||||
(if (not (equalp name "Sulfuras, Hand of Ragnaros"))
|
||||
(setf sell-in (- sell-in 1)))
|
||||
|
||||
(if (< sell-in 0)
|
||||
(if (not (equalp name "Aged Brie"))
|
||||
(if (not (equalp name "Backstage passes to a TAFKAL80ETC concert"))
|
||||
(if (> quality 0)
|
||||
(if (not (equalp name "Sulfuras, Hand of Ragnaros"))
|
||||
(setf quality (- quality 1))))
|
||||
(setf quality (- quality quality)))
|
||||
(if (< quality 50)
|
||||
(setf quality (+ quality 1)))))))))
|
||||
|
||||
;;; Example
|
||||
|
||||
(defun run-gilded-rose ()
|
||||
(write-line "OMGHAI!")
|
||||
(let* ((descriptions '(("+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)
|
||||
;; this conjured item does not work properly yet
|
||||
("Conjured Mana Cake" 3 6)))
|
||||
(items (loop for (name sell-in quality) in descriptions
|
||||
collect (make-instance 'item
|
||||
:name name
|
||||
:sell-in sell-in
|
||||
:quality quality)))
|
||||
(app (make-instance 'gilded-rose :items items))
|
||||
(days 2))
|
||||
#+sbcl
|
||||
(if (second sb-ext:*posix-argv*)
|
||||
(setf days (parse-integer (second sb-ext:*posix-argv*))))
|
||||
#+lispworks
|
||||
(if (fourth sys:*line-arguments-list*)
|
||||
(setf days (parse-integer (fourth sys:*line-arguments-list*))))
|
||||
(dotimes (i days)
|
||||
(format t "-------- day ~a --------~%" i)
|
||||
(format t "name, sell-in, quality~%")
|
||||
(dolist (item items)
|
||||
(write-line (to-string item)))
|
||||
(terpri)
|
||||
(update-quality app))))
|
||||
|
||||
(run-gilded-rose)
|
||||
|
||||
;;; ================================================================
|
||||
;;; EOF
|
||||
4
cpp-catch2/.gitignore
vendored
4
cpp-catch2/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
/build_meson/
|
||||
/subprojects/Catch2-*/
|
||||
/subprojects/packagecache/
|
||||
/cmake-build-*/
|
||||
@ -1,47 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.14..3.16)
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
project(GildedRoseKata VERSION 1.0
|
||||
DESCRIPTION "The GildedRose Refactoring kata for an approval testing approach"
|
||||
LANGUAGES CXX)
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(
|
||||
catch2
|
||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||
GIT_TAG v2.12.2
|
||||
)
|
||||
FetchContent_MakeAvailable(catch2)
|
||||
LIST(APPEND CMAKE_MODULE_PATH
|
||||
${catch2_SOURCE_DIR}/contrib
|
||||
)
|
||||
|
||||
FetchContent_Declare(
|
||||
approvaltests_ho
|
||||
URL https://github.com/approvals/ApprovalTests.cpp/releases/download/v.10.0.0/ApprovalTests.v.10.0.0.hpp
|
||||
DOWNLOAD_NO_EXTRACT TRUE
|
||||
DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/approvaltests
|
||||
DOWNLOAD_NAME ApprovalTests.v.10.0.0.hpp
|
||||
)
|
||||
FetchContent_GetProperties(approvaltests_ho)
|
||||
if (NOT approvaltests_ho_POPULATED)
|
||||
FetchContent_Populate(approvaltests_ho)
|
||||
endif ()
|
||||
add_library(approvaltests INTERFACE)
|
||||
target_include_directories(approvaltests
|
||||
INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/approvaltests
|
||||
INTERFACE ${catch2_SOURCE_DIR}/single_include/catch2
|
||||
)
|
||||
|
||||
add_executable(gildedrose_catch2
|
||||
src/GildedRose.h
|
||||
src/GildedRose.cc
|
||||
test/gildedrose_catch.cpp
|
||||
test/main.cpp)
|
||||
set_target_properties(gildedrose_catch2 PROPERTIES CXX_STANDARD 11)
|
||||
target_include_directories(gildedrose_catch2
|
||||
PUBLIC src)
|
||||
target_link_libraries(gildedrose_catch2 Catch2::Catch2 approvaltests)
|
||||
|
||||
include(CTest)
|
||||
include(ParseAndAddCatchTests)
|
||||
ParseAndAddCatchTests(gildedrose_catch2)
|
||||
@ -1,20 +0,0 @@
|
||||
C++ version of Gilded Rose with Catch 2 and Approvals
|
||||
======================================================
|
||||
|
||||
This is a C++ start of the ApprovalTest version of the Gilded Rose Refactoring Kata. See
|
||||
the [top level readme](https://github.com/emilybache/GildedRose-Refactoring-Kata)
|
||||
for a general description of the exercise.
|
||||
|
||||
|
||||
CMake
|
||||
-----
|
||||
|
||||
CMake is included in CLion from JetBrains. Without CMake files
|
||||
CLion has a hard time to handle c-projects.
|
||||
|
||||
To install CMake (if you don't use CLion) on macOS using brew
|
||||
|
||||
brew install cmake
|
||||
|
||||
Tested on CMake 3.15.3 (included with CLion 2019.3) on macOS
|
||||
|
||||
@ -1,80 +0,0 @@
|
||||
#include "GildedRose.h"
|
||||
|
||||
GildedRose::GildedRose(vector<Item> & items) : items(items)
|
||||
{}
|
||||
|
||||
void GildedRose::updateQuality()
|
||||
{
|
||||
for (int i = 0; i < items.size(); i++)
|
||||
{
|
||||
if (items[i].name != "Aged Brie" && items[i].name != "Backstage passes to a TAFKAL80ETC concert")
|
||||
{
|
||||
if (items[i].quality > 0)
|
||||
{
|
||||
if (items[i].name != "Sulfuras, Hand of Ragnaros")
|
||||
{
|
||||
items[i].quality = items[i].quality - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
|
||||
if (items[i].name == "Backstage passes to a TAFKAL80ETC concert")
|
||||
{
|
||||
if (items[i].sellIn < 11)
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (items[i].sellIn < 6)
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (items[i].name != "Sulfuras, Hand of Ragnaros")
|
||||
{
|
||||
items[i].sellIn = items[i].sellIn - 1;
|
||||
}
|
||||
|
||||
if (items[i].sellIn < 0)
|
||||
{
|
||||
if (items[i].name != "Aged Brie")
|
||||
{
|
||||
if (items[i].name != "Backstage passes to a TAFKAL80ETC concert")
|
||||
{
|
||||
if (items[i].quality > 0)
|
||||
{
|
||||
if (items[i].name != "Sulfuras, Hand of Ragnaros")
|
||||
{
|
||||
items[i].quality = items[i].quality - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
items[i].quality = items[i].quality - items[i].quality;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Item
|
||||
{
|
||||
public:
|
||||
string name;
|
||||
int sellIn;
|
||||
int quality;
|
||||
Item(string name, int sellIn, int quality) : name(name), sellIn(sellIn), quality(quality)
|
||||
{}
|
||||
};
|
||||
|
||||
class GildedRose
|
||||
{
|
||||
public:
|
||||
vector<Item> & items;
|
||||
GildedRose(vector<Item> & items);
|
||||
|
||||
void updateQuality();
|
||||
};
|
||||
|
||||
@ -1 +0,0 @@
|
||||
#include "ApprovalTests.v.10.0.0.hpp"
|
||||
@ -1,21 +0,0 @@
|
||||
#include <catch2/catch.hpp>
|
||||
#include "ApprovalTests.hpp"
|
||||
|
||||
#include "GildedRose.h"
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Item& obj)
|
||||
{
|
||||
return os
|
||||
<< "name: " << obj.name
|
||||
<< ", sellIn: " << obj.sellIn
|
||||
<< ", quality: " << obj.quality;
|
||||
}
|
||||
|
||||
TEST_CASE("UpdateQuality") {
|
||||
|
||||
vector<Item> items;
|
||||
items.push_back(Item("foo", 0, 0));
|
||||
GildedRose app(items);
|
||||
app.updateQuality();
|
||||
REQUIRE("fixme" == app.items[0].name);
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#define APPROVALS_CATCH
|
||||
|
||||
#include "catch2/catch.hpp"
|
||||
#include "ApprovalTests.hpp"
|
||||
4
cpp/.gitignore
vendored
4
cpp/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
.idea
|
||||
.vs
|
||||
cmake-build-debug
|
||||
build
|
||||
@ -1,37 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
project(gilded-rose-refactoring-kata-cpp)
|
||||
|
||||
# Load FetchContent module.
|
||||
include(FetchContent)
|
||||
|
||||
# Declare GoogleTest as the content to fetch
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
GIT_TAG release-1.8.1
|
||||
)
|
||||
|
||||
# Fetch GoogleTest amd make build scripts available
|
||||
if (NOT googletest_POPULATED)
|
||||
FetchContent_Populate(googletest)
|
||||
endif()
|
||||
|
||||
#set(gtest_force_shared_crt OFF CACHE BOOL "" FORCE)
|
||||
# Force Google Test to link the C/C++ runtimes dynamically when
|
||||
# building on Visual Studio
|
||||
# Link:
|
||||
# * https://github.com/google/googletest/tree/release-1.8.1/googletest#visual-studio-dynamic-vs-static-runtimes
|
||||
if (MSVC)
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
# Bring the populated content into the build
|
||||
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
|
||||
|
||||
# uncomment this line to enable coverage measurements using gcov
|
||||
# set(CMAKE_CXX_FLAGS "--coverage")
|
||||
|
||||
enable_testing()
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(test)
|
||||
@ -1,68 +0,0 @@
|
||||
# C++ version of Gilded Rose refactoring kata
|
||||
|
||||
## Introduction
|
||||
The C++ version of the Gilded Rose refactoring kata is available in four variants using different test frameworks:
|
||||
|
||||
* Catch2 test framework
|
||||
1. Traditional unit test with the [Catch2](https://github.com/catchorg/Catch2) test framework in the `test/cpp_catch2_unittest` folder.
|
||||
2. [Approval tests](https://github.com/approvals/ApprovalTests.cpp) with the [Catch2](https://github.com/catchorg/Catch2) test framework in the `test/cpp_catch2_approvaltest` folder.
|
||||
* Google Test framework
|
||||
1. Traditional unit test with the [Googletest](https://github.com/google/googletest) test framework in the `test/cpp_googletest_unittest` folder.
|
||||
2. [Approval tests](https://github.com/approvals/ApprovalTests.cpp) with the [Googletest](https://github.com/google/googletest) test framework in the `test/cpp_googletest_approvaltest` folder.
|
||||
|
||||
The `GildedRose.cc` file, i.e. the code under test, is identical in all four variants.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* CMake version >= 3.13
|
||||
* C++ compiler that support C++11
|
||||
|
||||
## How to build and run tests in a terminal
|
||||
|
||||
### Build tests
|
||||
|
||||
$ cd ${GIT_FOLDER}/GildedRose-Refactoring-Kata/cpp
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake ..
|
||||
$ cmake --build .
|
||||
|
||||
### Show available tests
|
||||
|
||||
$ cd ${GIT_FOLDER}/GildedRose-Refactoring-Kata/cpp/build
|
||||
$ ctest -N
|
||||
Test project ${GIT_FOLDER}/GildedRose-Refactoring-Kata/cpp/build
|
||||
Test #1: GildedRoseCatch2ApprovalTests
|
||||
Test #2: GildedRoseCatch2UnitTests
|
||||
Test #3: GildedRoseGoogletestApprovalTests
|
||||
Test #4: GildedRoseGoogletestUnitTests
|
||||
|
||||
### Run all tests
|
||||
|
||||
$ ctest
|
||||
|
||||
### Run all tests with verbose output
|
||||
|
||||
$ ctest -VV
|
||||
|
||||
### Run a specific test with verbose output
|
||||
|
||||
$ ctest -VV --tests-regex Catch2Approval
|
||||
|
||||
## How to build and run tests using the [CLion IDE](https://www.jetbrains.com/clion/)
|
||||
|
||||
1. Start CLion
|
||||
2. Select menu `File - Open...`
|
||||
3. Select folder `${GIT_FOLDER}/GildedRose-Refactoring-Kata/cpp`
|
||||
4. Select menu `Build - Build Project`
|
||||
4. Select menu `Run - Run...`
|
||||
4. Select what test variant to run, e.g. `GildedRoseCatch2ApprovalTests`.
|
||||
|
||||
## How to build and run tests using Visual Studio 2019
|
||||
|
||||
1. Start Visual Studio 2019
|
||||
2. Select `Open a local folder`
|
||||
3. Select folder `${GIT_FOLDER}/GildedRose-Refactoring-Kata/cpp`
|
||||
4. Wait for message `CMake generation finished.` in the CMake output window at the bottom
|
||||
5. Select what test variant to run in the drop down menu for Startup Items, e.g. `GildedRoseCatch2ApprovalTests.exe`.
|
||||
6. Select menu `Debug - Start`
|
||||
@ -1,4 +0,0 @@
|
||||
#ifndef APPROVAL_TEST_1_APPROVALTESTS_HPP
|
||||
#define APPROVAL_TEST_1_APPROVALTESTS_HPP
|
||||
#include "ApprovalTests.v.6.0.0.hpp"
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,3 +0,0 @@
|
||||
set(LIB_NAME lib)
|
||||
add_library(${LIB_NAME} INTERFACE)
|
||||
target_include_directories(${LIB_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
17597
cpp/lib/Catch.hpp
17597
cpp/lib/Catch.hpp
File diff suppressed because it is too large
Load Diff
@ -1,4 +0,0 @@
|
||||
set(SRC_LIB_NAME src)
|
||||
add_library(${SRC_LIB_NAME})
|
||||
target_sources(${SRC_LIB_NAME} PRIVATE GildedRose.cc)
|
||||
target_include_directories(${SRC_LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
@ -1,80 +0,0 @@
|
||||
#include "GildedRose.h"
|
||||
|
||||
GildedRose::GildedRose(vector<Item> & items) : items(items)
|
||||
{}
|
||||
|
||||
void GildedRose::updateQuality()
|
||||
{
|
||||
for (int i = 0; i < items.size(); i++)
|
||||
{
|
||||
if (items[i].name != "Aged Brie" && items[i].name != "Backstage passes to a TAFKAL80ETC concert")
|
||||
{
|
||||
if (items[i].quality > 0)
|
||||
{
|
||||
if (items[i].name != "Sulfuras, Hand of Ragnaros")
|
||||
{
|
||||
items[i].quality = items[i].quality - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
|
||||
if (items[i].name == "Backstage passes to a TAFKAL80ETC concert")
|
||||
{
|
||||
if (items[i].sellIn < 11)
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (items[i].sellIn < 6)
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (items[i].name != "Sulfuras, Hand of Ragnaros")
|
||||
{
|
||||
items[i].sellIn = items[i].sellIn - 1;
|
||||
}
|
||||
|
||||
if (items[i].sellIn < 0)
|
||||
{
|
||||
if (items[i].name != "Aged Brie")
|
||||
{
|
||||
if (items[i].name != "Backstage passes to a TAFKAL80ETC concert")
|
||||
{
|
||||
if (items[i].quality > 0)
|
||||
{
|
||||
if (items[i].name != "Sulfuras, Hand of Ragnaros")
|
||||
{
|
||||
items[i].quality = items[i].quality - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
items[i].quality = items[i].quality - items[i].quality;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (items[i].quality < 50)
|
||||
{
|
||||
items[i].quality = items[i].quality + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Item
|
||||
{
|
||||
public:
|
||||
string name;
|
||||
int sellIn;
|
||||
int quality;
|
||||
Item(string name, int sellIn, int quality) : name(name), sellIn(sellIn), quality(quality)
|
||||
{}
|
||||
};
|
||||
|
||||
class GildedRose
|
||||
{
|
||||
public:
|
||||
vector<Item> & items;
|
||||
GildedRose(vector<Item> & items);
|
||||
|
||||
void updateQuality();
|
||||
};
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
add_subdirectory(cpp_catch2_approvaltest)
|
||||
add_subdirectory(cpp_catch2_unittest)
|
||||
add_subdirectory(cpp_googletest_approvaltest)
|
||||
add_subdirectory(cpp_googletest_unittest)
|
||||
add_subdirectory(cpp_texttest)
|
||||
@ -1,15 +0,0 @@
|
||||
set(TEST_NAME GildedRoseCatch2ApprovalTests)
|
||||
add_executable(${TEST_NAME})
|
||||
target_sources(${TEST_NAME} PRIVATE GildedRoseCatch2ApprovalTests.cc)
|
||||
target_link_libraries(${TEST_NAME} lib src)
|
||||
set_property(TARGET ${TEST_NAME} PROPERTY CXX_STANDARD 11)
|
||||
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
|
||||
|
||||
# Set compiler option /FC for Visual Studio to to make the __FILE__ macro expand to full path.
|
||||
# The __FILE__ macro is used by Catch2 to get the path to current test file.
|
||||
# Links:
|
||||
# * https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2019
|
||||
# * https://docs.microsoft.com/en-us/cpp/build/reference/fc-full-path-of-source-code-file-in-diagnostics?view=vs-2019
|
||||
if (MSVC)
|
||||
target_compile_options(${TEST_NAME} PRIVATE "/FC")
|
||||
endif()
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user