mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-17 15:31:27 +00:00
Delete d directory
This commit is contained in:
parent
88066ababe
commit
dbefc9b96c
1
d/.gitignore
vendored
1
d/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
.dub
|
|
||||||
16
d/dub.json
16
d/dub.json
@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "GildedRose",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "GuildedRose",
|
|
||||||
"targetType": "executable",
|
|
||||||
"mainSourceFile": "src/GildedRoseTextTests.d"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "unittest",
|
|
||||||
"targetType": "executable",
|
|
||||||
"sourcePaths": ["test"],
|
|
||||||
"mainSourceFile": "test/GildedRoseUnitTests.d"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,93 +0,0 @@
|
|||||||
struct Item
|
|
||||||
{
|
|
||||||
string name;
|
|
||||||
int sellIn;
|
|
||||||
int quality;
|
|
||||||
}
|
|
||||||
|
|
||||||
class GildedRose
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Item[] items;
|
|
||||||
this(Item[] items)
|
|
||||||
{
|
|
||||||
this.items = items.dup;
|
|
||||||
}
|
|
||||||
|
|
||||||
void updateQuality()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < items.length; 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,38 +0,0 @@
|
|||||||
import GildedRose;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
import std.stdio : writefln, writeln;
|
|
||||||
|
|
||||||
Item[] items = [
|
|
||||||
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 doesn't yet work properly
|
|
||||||
Item("Conjured Mana Cake", 3, 6),
|
|
||||||
];
|
|
||||||
|
|
||||||
auto app = new GildedRose(items);
|
|
||||||
|
|
||||||
writeln("OMGHAI!");
|
|
||||||
|
|
||||||
for (int day = 0; day <= 30; day++)
|
|
||||||
{
|
|
||||||
writefln!"-------- day %s --------"(day);
|
|
||||||
writeln("Item(name, sellIn, quality)");
|
|
||||||
foreach (item; app.items)
|
|
||||||
{
|
|
||||||
writeln(item);
|
|
||||||
}
|
|
||||||
writeln;
|
|
||||||
|
|
||||||
app.updateQuality;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
import GildedRose;
|
|
||||||
|
|
||||||
unittest
|
|
||||||
{
|
|
||||||
Item[] items = [ Item("Foo", 0, 0)];
|
|
||||||
auto app = new GildedRose(items);
|
|
||||||
|
|
||||||
app.updateQuality;
|
|
||||||
|
|
||||||
assert("fixme" == app.items[0].name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void example()
|
|
||||||
{
|
|
||||||
Item[] items = [
|
|
||||||
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("Backstage passes to a TAFKAL80ETC concert", 15, 20),
|
|
||||||
Item("Conjured Mana Cake", 3, 6),
|
|
||||||
];
|
|
||||||
auto app = new GildedRose(items);
|
|
||||||
app.updateQuality;
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user