mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-25 11:21:44 +00:00
Keep desired languages
This commit is contained in:
parent
74291a62a6
commit
185adb7b41
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,41 +0,0 @@
|
||||
# Spécification de la Rose dorée (Gilded Rose)
|
||||
|
||||
Bonjour et bienvenue dans l'équipe de la Rose dorée.
|
||||
|
||||
Comme vous le savez, notre petite taverne située à proximité d'une cité importante est dirigée par l'amicale aubergiste Allison.
|
||||
|
||||
Nous achetons et vendons uniquement les meilleurs produits.
|
||||
Malheureusement, la qualité de nos marchandises se dégrade constamment à l'approche de leur date de péremption.
|
||||
|
||||
Un système a été mis en place pour mettre à jour notre inventaire.
|
||||
Il a été développé par Leeroy, une personne pleine de bon sens qui est parti pour de nouvelles aventures.
|
||||
|
||||
Votre mission est d'ajouter une nouvelle fonctionnalité à notre système pour que nous puissions commencer à vendre un nouveau type de produits.
|
||||
|
||||
Mais d'abord, laissez-moi vous présenter notre système :
|
||||
|
||||
- Tous les éléments ont une valeur `sellIn` qui désigne le nombre de jours restant pour vendre l'article.
|
||||
- Tous les articles ont une valeur `quality` qui dénote combien l'article est précieux.
|
||||
- À la fin de chaque journée, notre système diminue ces deux valeurs pour chaque produit.
|
||||
|
||||
Plutôt simple, non ?
|
||||
|
||||
Attendez, ça devient intéressant :
|
||||
|
||||
- Une fois que la date de péremption est passée, la qualité se dégrade deux fois plus rapidement.
|
||||
- La qualité (`quality`) d'un produit ne peut jamais être négative.
|
||||
- "Aged Brie" augmente sa qualité (`quality`) plus le temps passe.
|
||||
- La qualité d'un produit n'est jamais de plus de 50.
|
||||
- "Sulfuras", étant un objet légendaire, n'a pas de date de péremption et ne perd jamais en qualité (`quality`)
|
||||
- "Backstage passes", comme le "Aged Brie", augmente sa qualité (`quality`) plus le temps passe (`sellIn`) ; La qualité augmente de 2 quand il reste 10 jours ou moins et de 3 quand il reste 5 jours ou moins, mais la qualité tombe à 0 après le concert.
|
||||
|
||||
Nous avons récemment signé un partenariat avec un fournisseur de produit invoqué ("Conjured").
|
||||
Cela nécessite une mise à jour de notre système :
|
||||
|
||||
- les éléments "Conjured" voient leur qualité se dégrader de deux fois plus vite que les objets normaux.
|
||||
|
||||
Vous pouvez faire les changements que vous voulez à la méthode `updateQuality` et ajouter autant de code que vous voulez, tant que tout fonctionne correctement.
|
||||
Cependant, nous devons vous prévenir, vous ne devez en aucun cas modifier la classe `Item` ou ses propriétés car cette classe appartient au gobelin de l'étage et il entrera dans une rage instantanée et vous tuera sans délai : il ne croit pas au partage du code.
|
||||
(Vous pouvez ajouter une méthode `updateQuality` et des propriétés statiques dans la classe `Item` si vous voulez, nous vous couvrirons)
|
||||
|
||||
Juste une précision, un produit ne peut jamais voir sa qualité augmenter au-dessus de 50, cependant "Sulfuras" est un objet légendaire et comme tel sa qualité est de 80 et elle ne change jamais.
|
||||
@ -1,33 +0,0 @@
|
||||
# Gilded Rose 要件仕様書
|
||||
こんにちは、チーム・ギルドローズへようこそ。我々はアリソンという気さくな人が経営する、都会の一等地にある小さな宿です。
|
||||
|
||||
また、私たちは最高級の商品のみを仕入れて販売しています。残念なことに、商品は販売期限が近づくにつれ、品質が低下していきます。
|
||||
|
||||
私たちには在庫を更新するシステムがあります。これは、新たな冒険へと旅立ったリーロイという無神経な性格の人物によって開発されました。
|
||||
|
||||
あなたの仕事は、システムに新しい機能を追加して、新しいカテゴリーのアイテムを販売できるようにすることです。
|
||||
|
||||
最初にシステムの紹介をします。
|
||||
|
||||
* すべてのアイテムには、アイテムを販売するための残り日数(販売期限)を示すSellIn値があります。
|
||||
* すべてのアイテムには、そのアイテムの価値を示すQuality値があります。
|
||||
* 毎日の終わりには、私たちのシステムは、両方の項目の値を1小さくします。
|
||||
|
||||
簡単でしょ?ここからが面白いところです。
|
||||
|
||||
* 販売するための残り日数が無くなると、Quality値は2小さくなります。
|
||||
* Quality値は決してマイナスにはなりません。
|
||||
* "Aged Brie"は、日が経つほどQuality値が上がっていきます。
|
||||
* Quality値は50以上にはなりません。
|
||||
* "Sulfuras"は伝説のアイテムなので、販売されたり、Quality値が低下したりすることはありません。
|
||||
* "Backstage passes"は、"Aged Brie"と同様、SellIn値が近づくにつれてQuality値が上昇し、10日以内になると毎日2上がり、5日以内になると毎日3上がりますが、コンサート終了後には0になります。
|
||||
|
||||
最近、"Conjured"アイテムのサプライヤーと契約しました。そのため、システムの更新が必要です。
|
||||
|
||||
* "Conjured"アイテムは、通常のアイテムの2倍の速さで品質が劣化します。
|
||||
|
||||
すべてが正常に動作する限り、UpdateQualityメソッドに変更を加えたり、新しいコードを追加したりすることは自由に行ってください。ただし、ItemクラスやItemsプロパティは変更しないでください。
|
||||
|
||||
これらは、隅にいるゴブリンのものなので、コードの共有所有権を信じていないので、怒り狂ってあなたを一発で撃ってきます(UpdateQualityメソッドとItemsプロパティを静的にしても構いません。)
|
||||
|
||||
ただし、"Sulfuras "は伝説のアイテムであるため、Quality値は80であり、Quality値が変わることはありません。
|
||||
@ -1,37 +0,0 @@
|
||||
# Gilded Rose 요구사항 명세
|
||||
|
||||
안녕하세요, **Gilded Rose**에 오신 것을 환영합니다. 우리는 도시의 주요 지역에있는 작은 숙소(상점)이며, **Allison**(앨리슨)이라는 상냥한 사람이 운영하고 있습니다.
|
||||
|
||||
우리는 최고의 제품만을 구입하여 판매하고 있습니다. 불행히도, 상품 판매 기한이 가까워 질수록 품질이 저하되어가고 있습니다.
|
||||
|
||||
우리는 재고를 업데이트하는 시스템이 있습니다. 이 시스템은 지금은 새로운 모험을 떠나고 없는 **Leeroy**(리로이)라는 빡빡한 성격의 인물에 의해 개발되었습니다.
|
||||
|
||||
당신이 할 일은 시스템에 새로운 기능을 추가하여, 새로운 카테고리의 상품을 판매할 수 있도록하는 것입니다.
|
||||
|
||||
## 시스템 소개
|
||||
먼저 시스템을 소개합니다.
|
||||
|
||||
- 모든 아이템은 `SellIn` 값을 가지며, 이는 아이템을 판매해야하는 (남은) 기간을 나태냅니다.
|
||||
- 모든 아이템은 `Quality` 값을 가지며, 이것은 아이템의 가치를 나타냅니다.
|
||||
- 하루가 지날때마다, 시스템은 두 값(`SellIn`, `Quality`)을 *1* 씩 감소시킵니다.
|
||||
|
||||
간단하죠? 흥미로운 부분은 지금부터입니다.
|
||||
|
||||
- 판매하는 나머지 일수가 없어지면, `Quality` 값은 **2배**로 떨어집니다.
|
||||
- `Quality` 값은 결코 음수가 되지는 않습니다.
|
||||
- "**Aged Brie**"(오래된 브리치즈)은(는) 시간이 지날수록 `Quality` 값이 올라갑니다.
|
||||
- `Quality` 값은 50를 초과 할 수 없습니다.
|
||||
- `Sulfuras`는 전설의 아이템이므로, 반드시 판매될 필요도 없고 `Quality` 값도 떨어지지 않습니다.
|
||||
- "**Backstage passes**(백스테이지 입장권)"는 "**Aged Brie**"와 유사하게 `SellIn` 값에 가까워 질수록 `Quality` 값이 상승하고, **10일 전**까지는 매일 *2* 씩 증가하다, **5일 전**이 되면 매일 *3* 씩 증가하지만, 콘서트 종료 후에는 *0*으로 떨어집니다.
|
||||
|
||||
## 시스템 업데이트 요구 사항
|
||||
|
||||
최근 "**Conjured**"(마법에 걸린) 상품 공급 업체와 계약했습니다. 따라서 시스템의 업데이트가 필요합니다.
|
||||
|
||||
- "**Conjured**" 아이템은 일반 아이템의 2배의 속도로 품질(`Quality`)이 저하됩니다.
|
||||
|
||||
모든 것이 제대로 작동하는 한에서는 `UpdateQuality()` 메서드를 변경하거나 새로운 코드의 추가를 자유롭게 할 수 있습니다. 그러나 `Item` 클래스와 `Items` 속성은 변경하지 마세요.
|
||||
|
||||
이것들은 저기 구석에있는 고블린의 것이고, 그 친구는 코드의 공유 소유권을 믿지 않기 때문에, 미친듯이 화를 내며(insta-rage) 여러분에게 한 방(one-shot)을 날릴 수도 있습니다. (`UpdateQuality()` 메서드와 `Items` 속성을 정적(static)으로 만드는 것은 괜찮습니다. 저희가 책임질게요.)
|
||||
|
||||
다시 한 번 확인하자면, 아이템의 `Quality`는 50 이상으로 증가할 수는 없습니다. 하지만 `Sulfuras`는 전설의 아이템이기 때문에 `Quality` 값은 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,37 +0,0 @@
|
||||
# ข้อกำหนดความต้องการของระบบ Gilded Rose
|
||||
|
||||
ยินดีต้อนรับสู่ทีม Gilded Rose อย่างที่คุณทราบแล้วว่า เราคือโรงแรมขนาดเล็กที่ตั้งอยู่ทำเลทองของประเทศกรุงเทพ
|
||||
นอกจากนี้เรายังซื้อและขายเฉพาะสินค้าที่ดีที่สุด แต่น่าเสียดายยิ่งใกล้ถึงวันกำหนดขายสินค้า คุณภาพของสินค้าก็จะลดลงอย่างต่อเนื่อง
|
||||
ตอนนี้เรามีระบบที่ช่วยอัปเดตสินค้าคงคลังให้เรา มันถูกพัฒนาโดยโปรแกรมเมอร์ศิษย์เอกของพระอินทร์ ซึ่งโปรแกรมเมอร์คนนี้ได้ย้ายกลับไปอยู่กับพระอินทร์
|
||||
เป็นการถาวรแล้ว เราจึงอยากให้คุณช่วยเพิ่มฟีเจอร์ใหม่เพื่อให้เราสามารถขายสินค้าประเภทใหม่ได้
|
||||
|
||||
ก่อนอื่นเราขอแนะนำการทำงานของระบบปัจจุบัน:
|
||||
|
||||
- สินค้าแต่ละชิ้นจะต้องขายภายในระยะเวลาที่กำหนดไว้ในค่า "SellIn" (มีหน่วยเป็น*วัน*)
|
||||
- สินค้าแต่ละชิ้นจะระบุค่า "Quality" ที่สามารถบ่งชี้ถึงมูลค่าของสินค้า
|
||||
- ระบบจะทำการคำนวนค่า "SellIn" และ "Quality" ของสินค้าทุกชิ้นในช่วงเวลาสุดท้ายของทุกวัน
|
||||
|
||||
ง่ายอะดิ, ใช่ป่ะ? สิ่งที่น่าสนใจมันอยู่ตรงนี้:
|
||||
|
||||
- เมื่อสินค้าเลยกำหนดขายไปแล้ว "Quality" ของสินค้าจะลดลงเป็นสองเท่าจากปกติ
|
||||
- "Quality" ของสินค้าไม่มีทางติดลบได้
|
||||
- คุณภาพของสินค้าประเภท "Aged Brie" จะเพิ่มสูงขึ้นตามระยะเวลา
|
||||
- "Quality" มีค่าสูงสุดคือ 50
|
||||
- สินค้าประเภท "Sulfuras" เป็นสินค้าในตำนานหายาก คุณภาพของสินค้าจะไม่ลดลงและไม่ได้มีไว้เพื่อขาย
|
||||
- สินค้าประเภท "Backstage passes" คุณภาพของสินค้าเหมือนกันกับสินค้าประเภท aged brie
|
||||
เพียงแต่หากใกล้ถึงวันแสดง 10 วันก่อนหน้าหรือน้อยกว่าคุณภาพของสินค้าประเภทนี้จะเพิ่มทีละ 2 และถ้าใกล้ถึงวันก่อนวันแสดง 5 วันหรือน้อยกว่าคุณภาพจะเพิ่มทีละ 3
|
||||
อย่างไรก็ตามคุณภาพของสินค้าจะกลายเป็น 0 ทันทีหลังการแสดงจบลง
|
||||
|
||||
เมื่อเร็วๆ นี้เราพึ่งได้ลงนามกับผู้ผลิตสินค้าประเภทของขลังและของปลุกเสก
|
||||
และเราต้องการที่จะเพิ่มความสามารถใหม่เข้าไปในระบบ:
|
||||
|
||||
- คุณภาพสินค้าประเภท "Conjured" จะเสื่อมลงเร็วกว่าสินค้าปกติถึงสองเท่าจากปกติ
|
||||
|
||||
คุณสามารถปรับปรุงแก้ไขได้ทุกอย่างภายในเมธอด UpdateQuality และสามารถเพิ่มโค้ดใหม่ได้เลย
|
||||
ตราบใดที่ทุกอย่างยังคงทำงานได้ถูกต้อง อย่างไรก็ตามห้ามแก้ไขคลาส Item และคุณสมบัติของคลาส
|
||||
เพราะมันถูกลงอาคมจากโปรแกรมเมอร์จอมขมังเวทย์ที่ไม่เชื่อในเรื่องการแบ่งปันความเป็นเจ้าของโค้ดร่วมกับผู้อื่น
|
||||
(ถ้าคุณยังอยากจะแก้ไขทั้งเมธอด UpdateQuality และคุณสมบัติของคลาส Item เราก็จะ
|
||||
นิมนต์หลวงปู่เค็มมาช่วยคุ้มกันคุณ)
|
||||
|
||||
ย้ำอีกครั้งหนึ่ง, คุณภาพของสินค้ามีค่าสูงสุดคือ 50
|
||||
อย่างไรก็ตามสินค้าประเภท "Sulfuras" เป็นสินค้าหายากในตำนานมีค่า Quality เป็น 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()
|
||||
}
|
||||
3
Java-Spock/.gitignore
vendored
3
Java-Spock/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
.idea/
|
||||
.gradle/
|
||||
build/
|
||||
@ -1,9 +0,0 @@
|
||||
apply plugin: 'groovy'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
|
||||
}
|
||||
BIN
Java-Spock/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
Java-Spock/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@ -1,6 +0,0 @@
|
||||
#Tue Jul 05 09:24:35 CEST 2016
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip
|
||||
160
Java-Spock/gradlew
vendored
160
Java-Spock/gradlew
vendored
@ -1,160 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
90
Java-Spock/gradlew.bat
vendored
90
Java-Spock/gradlew.bat
vendored
@ -1,90 +0,0 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@ -1,62 +0,0 @@
|
||||
package com.gildedrose;
|
||||
|
||||
class GildedRose {
|
||||
Item[] items;
|
||||
|
||||
public GildedRose(Item[] items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public 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,21 +0,0 @@
|
||||
package com.gildedrose;
|
||||
|
||||
public class Item {
|
||||
|
||||
public String name;
|
||||
|
||||
public int sellIn;
|
||||
|
||||
public int quality;
|
||||
|
||||
public Item(String name, int sellIn, int quality) {
|
||||
this.name = name;
|
||||
this.sellIn = sellIn;
|
||||
this.quality = quality;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name + ", " + this.sellIn + ", " + this.quality;
|
||||
}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
package com.gildedrose;
|
||||
|
||||
public class TexttestFixture {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("OMGHAI!");
|
||||
|
||||
Item[] items = new Item[] {
|
||||
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) };
|
||||
|
||||
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++) {
|
||||
System.out.println("-------- day " + i + " --------");
|
||||
System.out.println("name, sellIn, quality");
|
||||
for (Item item : items) {
|
||||
System.out.println(item);
|
||||
}
|
||||
System.out.println();
|
||||
app.updateQuality();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
package com.gildedrose
|
||||
|
||||
import spock.lang.Specification
|
||||
|
||||
/**
|
||||
* Spock unit tests.
|
||||
*/
|
||||
class GildedRoseSpec extends Specification {
|
||||
|
||||
def "should update quality correctly"() {
|
||||
|
||||
given: "some items"
|
||||
Item[] items = [new Item("foo", 0, 0)];
|
||||
|
||||
and: "the application with these items"
|
||||
GildedRose app = new GildedRose(items);
|
||||
|
||||
when: "updating quality"
|
||||
app.updateQuality();
|
||||
|
||||
then: "the quality is correct"
|
||||
app.items[0].name == "fixme"
|
||||
}
|
||||
|
||||
}
|
||||
25
Kotlin/.gitignore
vendored
25
Kotlin/.gitignore
vendored
@ -1,25 +0,0 @@
|
||||
.idea/
|
||||
out/
|
||||
*.class
|
||||
|
||||
*.iml
|
||||
|
||||
# Created by https://www.gitignore.io/api/gradle
|
||||
|
||||
### Gradle ###
|
||||
.gradle
|
||||
**/build/
|
||||
|
||||
# Ignore Gradle GUI config
|
||||
gradle-app.setting
|
||||
|
||||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||
!gradle-wrapper.jar
|
||||
|
||||
# Cache of project
|
||||
.gradletasknamecache
|
||||
|
||||
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
|
||||
# gradle/wrapper/gradle-wrapper.properties
|
||||
|
||||
# End of https://www.gitignore.io/api/gradle
|
||||
@ -1,29 +0,0 @@
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "1.4.0"
|
||||
}
|
||||
|
||||
group = "com.gildedrose"
|
||||
version = "1.0-SNAPSHOT"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(kotlin("stdlib"))
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.6.2")
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
events("passed", "skipped", "failed")
|
||||
}
|
||||
}
|
||||
|
||||
// config JVM target to 1.8 for kotlin compilation tasks
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
BIN
Kotlin/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
Kotlin/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@ -1,5 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
188
Kotlin/gradlew
vendored
188
Kotlin/gradlew
vendored
@ -1,188 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
100
Kotlin/gradlew.bat
vendored
100
Kotlin/gradlew.bat
vendored
@ -1,100 +0,0 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@ -1,58 +0,0 @@
|
||||
package com.gildedrose
|
||||
|
||||
class GildedRose(var items: Array<Item>) {
|
||||
|
||||
fun updateQuality() {
|
||||
for (i in items.indices) {
|
||||
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,7 +0,0 @@
|
||||
package com.gildedrose
|
||||
|
||||
open class Item(var name: String, var sellIn: Int, var quality: Int) {
|
||||
override fun toString(): String {
|
||||
return this.name + ", " + this.sellIn + ", " + this.quality
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
package com.gildedrose
|
||||
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class GildedRoseTest {
|
||||
|
||||
@Test
|
||||
fun foo() {
|
||||
val items = arrayOf<Item>(Item("foo", 0, 0))
|
||||
val app = GildedRose(items)
|
||||
app.updateQuality()
|
||||
assertEquals("fixme", app.items[0].name)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
package com.gildedrose
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
println("OMGHAI!")
|
||||
|
||||
val items = arrayOf(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))
|
||||
|
||||
val app = GildedRose(items)
|
||||
|
||||
var days = 2
|
||||
if (args.size > 0) {
|
||||
days = Integer.parseInt(args[0]) + 1
|
||||
}
|
||||
|
||||
for (i in 0..days - 1) {
|
||||
println("-------- day $i --------")
|
||||
println("name, sellIn, quality")
|
||||
for (item in items) {
|
||||
println(item)
|
||||
}
|
||||
println()
|
||||
app.updateQuality()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -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
|
||||
! !
|
||||
@ -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,54 +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
|
||||
)
|
||||
|
||||
if( MINGW )
|
||||
# https://stackoverflow.com/questions/31890021/mingw-too-many-sections-bug-while-compiling-huge-header-file-in-qt
|
||||
set (CMAKE_CXX_FLAGS "-Wa,-mbig-obj ")
|
||||
endif()
|
||||
|
||||
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)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user