mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-04-12 17:47:16 +00:00
Remove all other languages except Kotlin
This commit is contained in:
parent
bfff84fbed
commit
e1f847d59d
@ -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}
|
|
||||||
5
C/README
5
C/README
@ -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,167 +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="single_exe" 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>
|
|
||||||
</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.
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
8
Java/.gitignore
vendored
8
Java/.gitignore
vendored
@ -1,8 +0,0 @@
|
|||||||
.idea/
|
|
||||||
*.iml
|
|
||||||
target/
|
|
||||||
|
|
||||||
.classpath
|
|
||||||
.project
|
|
||||||
bin/
|
|
||||||
.settings/
|
|
||||||
37
Java/pom.xml
37
Java/pom.xml
@ -1,37 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<groupId>com.gildedrose</groupId>
|
|
||||||
<artifactId>gilded-rose-kata</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<java.version>1.8</java.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>4.12</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>${java.version}</source>
|
|
||||||
<target>${java.version}</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@ -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,17 +0,0 @@
|
|||||||
package com.gildedrose;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class GildedRoseTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void foo() {
|
|
||||||
Item[] items = new Item[] { new Item("foo", 0, 0) };
|
|
||||||
GildedRose app = new GildedRose(items);
|
|
||||||
app.updateQuality();
|
|
||||||
assertEquals("fixme", app.items[0].name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
18
R/.project
18
R/.project
@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>GildedRose.R</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>de.walware.statet.r.builders.RSupport</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>de.walware.statet.base.StatetNature</nature>
|
|
||||||
<nature>de.walware.statet.r.RNature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
source('item.R')
|
|
||||||
|
|
||||||
update_quality <- function(items) {
|
|
||||||
lapply(items,
|
|
||||||
function(item) {
|
|
||||||
|
|
||||||
if (item$name != "Aged Brie" && item$name != "Backstage passes to a TAFKAL80ETC concert") {
|
|
||||||
if (item$quality > 0) {
|
|
||||||
if (item$name != "Sulfuras, Hand of Ragnaros") {
|
|
||||||
item$quality <- item$quality - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (item$quality < 50) {
|
|
||||||
item$quality <- item$quality + 1
|
|
||||||
if (item$name == "Backstage passes to a TAFKAL80ETC concert") {
|
|
||||||
if (item$sell_in < 11) {
|
|
||||||
if (item$quality < 50) {
|
|
||||||
item$quality = item$quality + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (item$sell_in < 6) {
|
|
||||||
if (item$quality < 50) {
|
|
||||||
item$quality = item$quality + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item$name != "Sulfuras, Hand of Ragnaros") {
|
|
||||||
item$sell_in <- item$sell_in - 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item$sell_in < 0) {
|
|
||||||
if (item$name != "Aged Brie") {
|
|
||||||
if (item$name != "Backstage passes to a TAFKAL80ETC concert") {
|
|
||||||
if (item$quality > 0) {
|
|
||||||
if (item$name != "Sulfuras, Hand of Ragnaros") {
|
|
||||||
item$quality <- item$quality - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
item$quality <- item$quality - item$quality
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (item$quality < 50) {
|
|
||||||
item$quality <- item$quality + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
item
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
13
R/item.R
13
R/item.R
@ -1,13 +0,0 @@
|
|||||||
item <- function(name, sell_in, quality) {
|
|
||||||
newItem <- list(name=name, sell_in=sell_in, quality=quality)
|
|
||||||
class(newItem) <- 'item'
|
|
||||||
newItem
|
|
||||||
}
|
|
||||||
|
|
||||||
as.character.item <- function(item) {
|
|
||||||
paste(item$name, ", ", item$sell_in, ", ", item$quality, sep='')
|
|
||||||
}
|
|
||||||
|
|
||||||
print.item <- function(item) {
|
|
||||||
print.default(as.character(item))
|
|
||||||
}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
source('gilded_rose.R')
|
|
||||||
|
|
||||||
test.foo <- function() {
|
|
||||||
items <- list( item('foo', 0, 0) )
|
|
||||||
items <- update_quality(items)
|
|
||||||
checkEquals('fixme', items[[1]]$name);
|
|
||||||
}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
# A little helper script to get the testing infrastructure started
|
|
||||||
|
|
||||||
# install.packages("RUnit")
|
|
||||||
require(RUnit)
|
|
||||||
|
|
||||||
# execute single test file
|
|
||||||
runTestFile("runit_gilded_rose.R")
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
rm(list=ls())
|
|
||||||
|
|
||||||
source('gilded_rose.R')
|
|
||||||
|
|
||||||
writeLines('OMGHAI!')
|
|
||||||
|
|
||||||
items <- list(
|
|
||||||
item('+5 Dexterity Vest', 10, 20),
|
|
||||||
item('Aged Brie', 2, 0),
|
|
||||||
item('Elixir of the Mongoose', 5, 7),
|
|
||||||
item('Sulfuras, Hand of Ragnaros', 0, 80),
|
|
||||||
item('Sulfuras, Hand of Ragnaros', -1, 80),
|
|
||||||
item('Backstage passes to a TAFKAL80ETC concert', 15, 20),
|
|
||||||
item('Backstage passes to a TAFKAL80ETC concert', 10, 49),
|
|
||||||
item('Backstage passes to a TAFKAL80ETC concert', 5, 49),
|
|
||||||
# This Conjured item does not work properly yet
|
|
||||||
item('Conjured Mana Cake', 3, 6)
|
|
||||||
)
|
|
||||||
|
|
||||||
days <- 2
|
|
||||||
for (day in 0:days) {
|
|
||||||
writeLines(paste('-------- day ', day, ' --------', sep=''))
|
|
||||||
writeLines('name, sellIn, quality')
|
|
||||||
lapply(items,
|
|
||||||
function(item) {
|
|
||||||
writeLines(as.character(item))
|
|
||||||
}
|
|
||||||
)
|
|
||||||
writeLines('')
|
|
||||||
items <- update_quality(items)
|
|
||||||
}
|
|
||||||
|
|
||||||
rm('day', 'days', 'items')
|
|
||||||
File diff suppressed because one or more lines are too long
10
TypeScript/.gitignore
vendored
10
TypeScript/.gitignore
vendored
@ -1,10 +0,0 @@
|
|||||||
.DS_Store
|
|
||||||
.idea
|
|
||||||
node_modules
|
|
||||||
typings
|
|
||||||
app/**/*.js
|
|
||||||
app/**/*.js.map
|
|
||||||
test/**/*.js
|
|
||||||
test/**/*.js.map
|
|
||||||
coverage
|
|
||||||
.nyc_output
|
|
||||||
@ -1,69 +0,0 @@
|
|||||||
export class Item {
|
|
||||||
name: string;
|
|
||||||
sellIn: number;
|
|
||||||
quality: number;
|
|
||||||
|
|
||||||
constructor(name, sellIn, quality) {
|
|
||||||
this.name = name;
|
|
||||||
this.sellIn = sellIn;
|
|
||||||
this.quality = quality;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class GildedRose {
|
|
||||||
items: Array<Item>;
|
|
||||||
|
|
||||||
constructor(items = []) {
|
|
||||||
this.items = items;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateQuality() {
|
|
||||||
for (let i = 0; i < this.items.length; i++) {
|
|
||||||
if (this.items[i].name != 'Aged Brie' && this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
|
|
||||||
if (this.items[i].quality > 0) {
|
|
||||||
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
|
||||||
this.items[i].quality = this.items[i].quality - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (this.items[i].quality < 50) {
|
|
||||||
this.items[i].quality = this.items[i].quality + 1
|
|
||||||
if (this.items[i].name == 'Backstage passes to a TAFKAL80ETC concert') {
|
|
||||||
if (this.items[i].sellIn < 11) {
|
|
||||||
if (this.items[i].quality < 50) {
|
|
||||||
this.items[i].quality = this.items[i].quality + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.items[i].sellIn < 6) {
|
|
||||||
if (this.items[i].quality < 50) {
|
|
||||||
this.items[i].quality = this.items[i].quality + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
|
||||||
this.items[i].sellIn = this.items[i].sellIn - 1;
|
|
||||||
}
|
|
||||||
if (this.items[i].sellIn < 0) {
|
|
||||||
if (this.items[i].name != 'Aged Brie') {
|
|
||||||
if (this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
|
|
||||||
if (this.items[i].quality > 0) {
|
|
||||||
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
|
||||||
this.items[i].quality = this.items[i].quality - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.items[i].quality = this.items[i].quality - this.items[i].quality
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (this.items[i].quality < 50) {
|
|
||||||
this.items[i].quality = this.items[i].quality + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.items;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "typescript-mocha-kata-seed",
|
|
||||||
"version": "1.4.0",
|
|
||||||
"description": "Seed project for TDD code katas on TypeScript and mocha",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"precompile": "rimraf app/**/*.js test/**/*.js",
|
|
||||||
"compile": "tsc",
|
|
||||||
"pretest": "rimraf app/**/*.js test/**/*.js",
|
|
||||||
"test": "nyc mocha"
|
|
||||||
},
|
|
||||||
"author": "paucls",
|
|
||||||
"homepage": "https://github.com/paucls/typescript-mocha-kata-seed",
|
|
||||||
"license": "ISC",
|
|
||||||
"private": true,
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/chai": "~3.5.2",
|
|
||||||
"@types/mocha": "~2.2.41",
|
|
||||||
"@types/node": "~7.0.18",
|
|
||||||
"chai": "~3.5.0",
|
|
||||||
"mocha": "~3.2.0",
|
|
||||||
"nyc": "~11.0.3",
|
|
||||||
"rimraf": "~2.5.2",
|
|
||||||
"ts-node": "~3.1.0",
|
|
||||||
"typescript": "~2.2.0"
|
|
||||||
},
|
|
||||||
"nyc": {
|
|
||||||
"extension": [
|
|
||||||
".ts"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"**/*.d.ts",
|
|
||||||
"test/**"
|
|
||||||
],
|
|
||||||
"require": [
|
|
||||||
"ts-node/register"
|
|
||||||
],
|
|
||||||
"reporter": [
|
|
||||||
"html",
|
|
||||||
"text"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
import { expect } from 'chai';
|
|
||||||
import { Item, GildedRose } from '../app/gilded-rose';
|
|
||||||
|
|
||||||
describe('Gilded Rose', function () {
|
|
||||||
|
|
||||||
it('should foo', function() {
|
|
||||||
const gildedRose = new GildedRose([ new Item('foo', 0, 0) ]);
|
|
||||||
const items = gildedRose.updateQuality();
|
|
||||||
expect(items[0].name).to.equal('fixme');
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
--compilers ts-node/register
|
|
||||||
--require source-map-support/register
|
|
||||||
--recursive
|
|
||||||
test/**/*.ts
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "commonjs",
|
|
||||||
"target": "es5",
|
|
||||||
"noImplicitAny": false,
|
|
||||||
"sourceMap": false
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"node_modules"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
# Gilded Rose Refactoring Kata in [ABAP](http://scn.sap.com/community/abap/)
|
|
||||||
|
|
||||||
## Prerequisite
|
|
||||||
|
|
||||||
Access to SAP NetWeaver server with at least ABAP 7.40
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
Assuming you have a proper developer key set up, run SE38
|
|
||||||
* create a new Module Pool (type M) program as a Local Object
|
|
||||||
* paste the raw code from [YY_PAO_GILDED_ROSE.abap](https://raw.githubusercontent.com/brehberg/GildedRose-Refactoring-Kata/master/abap/YY_PAO_GILDED_ROSE.abap)
|
|
||||||
* save (Ctrl-S) and activate (Ctrl-F3) the program
|
|
||||||
|
|
||||||
## Running Tests
|
|
||||||
|
|
||||||
From the menus choose Program -> Execute -> Unit Tests (Ctrl+Shift+F10)
|
|
||||||
@ -1,242 +0,0 @@
|
|||||||
*&---------------------------------------------------------------------*
|
|
||||||
*& Gilded Rose Requirements Specification
|
|
||||||
*&---------------------------------------------------------------------*
|
|
||||||
*&
|
|
||||||
*& Hi and welcome to team Gilded Rose. As you know, we are a small inn with
|
|
||||||
*& a prime location in a prominent city ran by a friendly innkeeper named
|
|
||||||
*& Allison. We also buy and sell only the finest goods. Unfortunately, our
|
|
||||||
*& goods are constantly degrading in quality as they approach their sell by
|
|
||||||
*& date. We have a system in place that updates our inventory for us. It
|
|
||||||
*& was developed by a no-nonsense type named Leeroy, who has moved on to
|
|
||||||
*& new adventures. Your task is to add the new feature to our system so that
|
|
||||||
*& we can begin selling a new category of items.
|
|
||||||
*&
|
|
||||||
*& First an introduction to our system:
|
|
||||||
*&
|
|
||||||
*& - All items have a Sell In value which denotes the number of
|
|
||||||
*& days we have to sell the item
|
|
||||||
*& - All items have a Quality value which denotes how valuable the item is
|
|
||||||
*& - At the end of each day our system lowers both values for every item
|
|
||||||
*&
|
|
||||||
*& Seems pretty simple, right? Well this is where it gets interesting:
|
|
||||||
*&
|
|
||||||
*& - Once the sell by date has passed, Quality degrades twice as fast
|
|
||||||
*& - The Quality of an item is never negative
|
|
||||||
*& - "Aged Brie" actually increases in Quality the older it gets
|
|
||||||
*& - The Quality of an item is never more than 50
|
|
||||||
*& - "Sulfuras", being a legendary item, never has to be sold or
|
|
||||||
*& decreases in Quality
|
|
||||||
*& - "Backstage passes", like aged brie, increases in Quality as its
|
|
||||||
*& Sell In value approaches; Quality increases by 2 when there
|
|
||||||
*& are 10 days or less and by 3 when there are 5 days or less
|
|
||||||
*& but Quality drops to 0 after the concert
|
|
||||||
*&
|
|
||||||
*& We have recently signed a supplier of conjured items. This requires an
|
|
||||||
*& update to our system:
|
|
||||||
*&
|
|
||||||
*& - "Conjured" items degrade in Quality twice as fast as normal items
|
|
||||||
*&
|
|
||||||
*& Feel free to make any changes to the Update Quality method and add any new
|
|
||||||
*& code as long as everything still works correctly. However, do not alter
|
|
||||||
*& the Item class directly or Items table attribute as those belong to the
|
|
||||||
*& goblin in the corner who will insta-rage and one-shot you as he doesn't
|
|
||||||
*& believe in shared code ownership (you can make the Update Quality method
|
|
||||||
*& and Items property static if you must, we'll cover for you).
|
|
||||||
*&
|
|
||||||
*& Just for clarification, an item can never have its Quality increase
|
|
||||||
*& above 50, however "Sulfuras" is a legendary item and as such its Quality
|
|
||||||
*& is 80 and it never alters.
|
|
||||||
|
|
||||||
PROGRAM yy_pao_gilded_rose.
|
|
||||||
|
|
||||||
|
|
||||||
*& Production Code - Class Library
|
|
||||||
CLASS lcl_item DEFINITION DEFERRED.
|
|
||||||
|
|
||||||
CLASS lcl_gilded_rose DEFINITION FINAL.
|
|
||||||
PUBLIC SECTION.
|
|
||||||
TYPES:
|
|
||||||
tt_items TYPE STANDARD TABLE OF REF TO lcl_item WITH EMPTY KEY.
|
|
||||||
METHODS:
|
|
||||||
constructor
|
|
||||||
IMPORTING it_items TYPE tt_items,
|
|
||||||
update_quality.
|
|
||||||
|
|
||||||
PRIVATE SECTION.
|
|
||||||
DATA:
|
|
||||||
mt_items TYPE tt_items.
|
|
||||||
ENDCLASS.
|
|
||||||
|
|
||||||
CLASS lcl_item DEFINITION FINAL.
|
|
||||||
PUBLIC SECTION.
|
|
||||||
METHODS:
|
|
||||||
constructor
|
|
||||||
IMPORTING iv_name TYPE string
|
|
||||||
iv_sell_in TYPE i
|
|
||||||
iv_quality TYPE i,
|
|
||||||
description
|
|
||||||
RETURNING VALUE(rv_string) TYPE string.
|
|
||||||
DATA:
|
|
||||||
mv_name TYPE string,
|
|
||||||
mv_sell_in TYPE i,
|
|
||||||
mv_quality TYPE i.
|
|
||||||
ENDCLASS.
|
|
||||||
|
|
||||||
CLASS lcl_gilded_rose IMPLEMENTATION.
|
|
||||||
|
|
||||||
METHOD constructor.
|
|
||||||
mt_items = it_items.
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
METHOD update_quality.
|
|
||||||
|
|
||||||
LOOP AT mt_items INTO DATA(lo_item).
|
|
||||||
IF lo_item->mv_name <> |Aged Brie| AND
|
|
||||||
lo_item->mv_name <> |Backstage passes to a TAFKAL80ETC concert|.
|
|
||||||
IF lo_item->mv_quality > 0.
|
|
||||||
IF lo_item->mv_name <> |Sulfuras, Hand of Ragnaros|.
|
|
||||||
lo_item->mv_quality = lo_item->mv_quality - 1.
|
|
||||||
ENDIF.
|
|
||||||
ENDIF.
|
|
||||||
ELSE.
|
|
||||||
IF lo_item->mv_quality < 50.
|
|
||||||
lo_item->mv_quality = lo_item->mv_quality + 1.
|
|
||||||
|
|
||||||
IF lo_item->mv_name = |Backstage passes to a TAFKAL80ETC concert|.
|
|
||||||
IF lo_item->mv_sell_in < 11.
|
|
||||||
IF lo_item->mv_quality < 50.
|
|
||||||
lo_item->mv_quality = lo_item->mv_quality + 1.
|
|
||||||
ENDIF.
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
IF lo_item->mv_sell_in < 6.
|
|
||||||
IF lo_item->mv_quality < 50.
|
|
||||||
lo_item->mv_quality = lo_item->mv_quality + 1.
|
|
||||||
ENDIF.
|
|
||||||
ENDIF.
|
|
||||||
ENDIF.
|
|
||||||
ENDIF.
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
IF lo_item->mv_name <> |Sulfuras, Hand of Ragnaros|.
|
|
||||||
lo_item->mv_sell_in = lo_item->mv_sell_in - 1.
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
IF lo_item->mv_sell_in < 0.
|
|
||||||
IF lo_item->mv_name <> |Aged Brie|.
|
|
||||||
IF lo_item->mv_name <> |Backstage passes to a TAFKAL80ETC concert|.
|
|
||||||
IF lo_item->mv_quality > 0.
|
|
||||||
IF lo_item->mv_name <> |Sulfuras, Hand of Ragnaros|.
|
|
||||||
lo_item->mv_quality = lo_item->mv_quality - 1.
|
|
||||||
ENDIF.
|
|
||||||
ENDIF.
|
|
||||||
ELSE.
|
|
||||||
lo_item->mv_quality = lo_item->mv_quality - lo_item->mv_quality.
|
|
||||||
ENDIF.
|
|
||||||
ELSE.
|
|
||||||
IF lo_item->mv_quality < 50.
|
|
||||||
lo_item->mv_quality = lo_item->mv_quality + 1.
|
|
||||||
ENDIF.
|
|
||||||
ENDIF.
|
|
||||||
ENDIF.
|
|
||||||
ENDLOOP.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
ENDCLASS.
|
|
||||||
|
|
||||||
CLASS lcl_item IMPLEMENTATION.
|
|
||||||
|
|
||||||
METHOD constructor.
|
|
||||||
mv_name = iv_name.
|
|
||||||
mv_sell_in = iv_sell_in.
|
|
||||||
mv_quality = iv_quality.
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
METHOD description.
|
|
||||||
rv_string = |{ mv_name }, { mv_sell_in }, { mv_quality }|.
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
ENDCLASS.
|
|
||||||
|
|
||||||
|
|
||||||
*& Test Code - Executable Text Test Fixture
|
|
||||||
CLASS lth_texttest_fixture DEFINITION FINAL.
|
|
||||||
PUBLIC SECTION.
|
|
||||||
CLASS-METHODS main.
|
|
||||||
ENDCLASS.
|
|
||||||
|
|
||||||
CLASS lth_texttest_fixture IMPLEMENTATION.
|
|
||||||
METHOD main.
|
|
||||||
DATA(lo_out) = cl_demo_output=>new( )->write_text( |OMGHAI!| ).
|
|
||||||
|
|
||||||
DATA(lt_items) = VALUE lcl_gilded_rose=>tt_items(
|
|
||||||
( NEW #( iv_name = |+5 Dexterity Vest|
|
|
||||||
iv_sell_in = 10
|
|
||||||
iv_quality = 20 ) )
|
|
||||||
( NEW #( iv_name = |Aged Brie|
|
|
||||||
iv_sell_in = 2
|
|
||||||
iv_quality = 0 ) )
|
|
||||||
( NEW #( iv_name = |Elixir of the Mongoose|
|
|
||||||
iv_sell_in = 5
|
|
||||||
iv_quality = 7 ) )
|
|
||||||
( NEW #( iv_name = |Sulfuras, Hand of Ragnaros|
|
|
||||||
iv_sell_in = 0
|
|
||||||
iv_quality = 80 ) )
|
|
||||||
( NEW #( iv_name = |Backstage passes to a TAFKAL80ETC concert|
|
|
||||||
iv_sell_in = 15
|
|
||||||
iv_quality = 20 ) )
|
|
||||||
( NEW #( iv_name = |Backstage passes to a TAFKAL80ETC concert|
|
|
||||||
iv_sell_in = 10
|
|
||||||
iv_quality = 49 ) )
|
|
||||||
( NEW #( iv_name = |Backstage passes to a TAFKAL80ETC concert|
|
|
||||||
iv_sell_in = 5
|
|
||||||
iv_quality = 49 ) )
|
|
||||||
"This conjured item does not work properly yet
|
|
||||||
( NEW #( iv_name = |Conjured Mana Cake|
|
|
||||||
iv_sell_in = 3
|
|
||||||
iv_quality = 6 ) ) ).
|
|
||||||
|
|
||||||
DATA(lo_app) = NEW lcl_gilded_rose( it_items = lt_items ).
|
|
||||||
|
|
||||||
DATA(lv_days) = 2.
|
|
||||||
cl_demo_input=>request( EXPORTING text = |Number of Days?|
|
|
||||||
CHANGING field = lv_days ).
|
|
||||||
|
|
||||||
DO lv_days TIMES.
|
|
||||||
lo_out->next_section( |-------- day { sy-index } --------| ).
|
|
||||||
lo_out->write_text( |Name, Sell_In, Quality| ).
|
|
||||||
LOOP AT lt_items INTO DATA(lo_item).
|
|
||||||
lo_out->write_text( lo_item->description( ) ).
|
|
||||||
ENDLOOP.
|
|
||||||
lo_app->update_quality( ).
|
|
||||||
ENDDO.
|
|
||||||
|
|
||||||
lo_out->display( ).
|
|
||||||
ENDMETHOD.
|
|
||||||
ENDCLASS.
|
|
||||||
|
|
||||||
|
|
||||||
*& Test Code - Currently Broken
|
|
||||||
CLASS ltc_gilded_rose DEFINITION FINAL FOR TESTING RISK LEVEL HARMLESS.
|
|
||||||
PRIVATE SECTION.
|
|
||||||
METHODS:
|
|
||||||
foo FOR TESTING.
|
|
||||||
ENDCLASS.
|
|
||||||
|
|
||||||
CLASS ltc_gilded_rose IMPLEMENTATION.
|
|
||||||
|
|
||||||
METHOD foo.
|
|
||||||
DATA(lt_items) = VALUE lcl_gilded_rose=>tt_items( ( NEW #( iv_name = |foo|
|
|
||||||
iv_sell_in = 0
|
|
||||||
iv_quality = 0 ) ) ).
|
|
||||||
|
|
||||||
DATA(lo_app) = NEW lcl_gilded_rose( it_items = lt_items ).
|
|
||||||
lo_app->update_quality( ).
|
|
||||||
|
|
||||||
cl_abap_unit_assert=>assert_equals(
|
|
||||||
act = CAST lcl_item( lt_items[ 1 ] )->mv_name
|
|
||||||
exp = |fixme| ).
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
ENDCLASS.
|
|
||||||
@ -1,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,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,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
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.4)
|
|
||||||
project(cpp)
|
|
||||||
|
|
||||||
# CMake FindThreads is broken until 3.1
|
|
||||||
#find_package(Threads REQUIRED)
|
|
||||||
set(CMAKE_THREAD_LIBS_INIT pthread)
|
|
||||||
|
|
||||||
enable_testing()
|
|
||||||
find_package(GTest REQUIRED)
|
|
||||||
include_directories(${GTEST_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
set(GILDED_ROSE_SOURCE_FILES
|
|
||||||
GildedRose.cc
|
|
||||||
GildedRose.h
|
|
||||||
GildedRoseUnitTests.cc)
|
|
||||||
|
|
||||||
set(GILDED_ROSE_TEXT_TESTS_SOURCE_FILES
|
|
||||||
GildedRose.cc
|
|
||||||
GildedRose.h
|
|
||||||
GildedRoseTextTests.cc)
|
|
||||||
|
|
||||||
set(SOURCE_FILES
|
|
||||||
${GILDED_ROSE_SOURCE_FILES}
|
|
||||||
${GILDED_ROSE_TEXT_TESTS_SOURCE_FILES})
|
|
||||||
|
|
||||||
add_executable(GildedRose ${GILDED_ROSE_SOURCE_FILES})
|
|
||||||
target_link_libraries(GildedRose ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
|
||||||
|
|
||||||
add_executable(GildedRoseTextTests ${GILDED_ROSE_TEXT_TESTS_SOURCE_FILES})
|
|
||||||
target_link_libraries(GildedRoseTextTests ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
|
||||||
@ -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,42 +0,0 @@
|
|||||||
#include "GildedRose.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
ostream& operator<<(ostream& s, Item& item)
|
|
||||||
{
|
|
||||||
s << item.name << ", " << item.sellIn << ", " << item.quality;
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
vector<Item> items;
|
|
||||||
items.push_back(Item("+5 Dexterity Vest", 10, 20));
|
|
||||||
items.push_back(Item("Aged Brie", 2, 0));
|
|
||||||
items.push_back(Item("Elixir of the Mongoose", 5, 7));
|
|
||||||
items.push_back(Item("Sulfuras, Hand of Ragnaros", 0, 80));
|
|
||||||
items.push_back(Item("Sulfuras, Hand of Ragnaros", -1, 80));
|
|
||||||
items.push_back(Item("Backstage passes to a TAFKAL80ETC concert", 15, 20));
|
|
||||||
items.push_back(Item("Backstage passes to a TAFKAL80ETC concert", 10, 49));
|
|
||||||
items.push_back(Item("Backstage passes to a TAFKAL80ETC concert", 5, 49));
|
|
||||||
// this Conjured item doesn't yet work properly
|
|
||||||
items.push_back(Item("Conjured Mana Cake", 3, 6));
|
|
||||||
GildedRose app(items);
|
|
||||||
|
|
||||||
cout << "OMGHAI!" << endl;
|
|
||||||
|
|
||||||
for (int day = 0; day <= 30; day++)
|
|
||||||
{
|
|
||||||
cout << "-------- day " << day << " --------" << endl;
|
|
||||||
cout << "name, sellIn, quality" << endl;
|
|
||||||
for (vector<Item>::iterator i = items.begin(); i != items.end(); i++)
|
|
||||||
{
|
|
||||||
cout << *i << endl;
|
|
||||||
}
|
|
||||||
cout << endl;
|
|
||||||
|
|
||||||
app.updateQuality();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
#include <gtest/gtest.h>
|
|
||||||
|
|
||||||
#include "GildedRose.h"
|
|
||||||
|
|
||||||
TEST(GildedRoseTest, Foo) {
|
|
||||||
vector<Item> items;
|
|
||||||
items.push_back(Item("Foo", 0, 0));
|
|
||||||
GildedRose app(items);
|
|
||||||
app.updateQuality();
|
|
||||||
EXPECT_EQ("fixme", app.items[0].name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void example()
|
|
||||||
{
|
|
||||||
vector<Item> items;
|
|
||||||
items.push_back(Item("+5 Dexterity Vest", 10, 20));
|
|
||||||
items.push_back(Item("Aged Brie", 2, 0));
|
|
||||||
items.push_back(Item("Elixir of the Mongoose", 5, 7));
|
|
||||||
items.push_back(Item("Sulfuras, Hand of Ragnaros", 0, 80));
|
|
||||||
items.push_back(Item("Backstage passes to a TAFKAL80ETC concert", 15, 20));
|
|
||||||
items.push_back(Item("Conjured Mana Cake", 3, 6));
|
|
||||||
GildedRose app(items);
|
|
||||||
app.updateQuality();
|
|
||||||
}
|
|
||||||
85
cpp/Makefile
85
cpp/Makefile
@ -1,85 +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, except GTEST_HEADERS, which you can use in your own targets
|
|
||||||
# but shouldn't modify.
|
|
||||||
|
|
||||||
# Points to the root of Google Test, relative to where this file is.
|
|
||||||
# Remember to tweak this if you move this file.
|
|
||||||
GTEST_DIR = gtest
|
|
||||||
|
|
||||||
# Where to find user code.
|
|
||||||
USER_DIR = .
|
|
||||||
|
|
||||||
# Flags passed to the preprocessor.
|
|
||||||
CPPFLAGS += -I$(GTEST_DIR)/include
|
|
||||||
|
|
||||||
# Flags passed to the C++ compiler.
|
|
||||||
CXXFLAGS += -g -Wall -Wextra
|
|
||||||
|
|
||||||
# All tests produced by this Makefile. Remember to add new tests you
|
|
||||||
# created to the list.
|
|
||||||
TESTS = GildedRose
|
|
||||||
|
|
||||||
TEXTTESTS = GildedRoseTextTests
|
|
||||||
|
|
||||||
# All Google Test headers. Usually you shouldn't change this
|
|
||||||
# definition.
|
|
||||||
GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \
|
|
||||||
$(GTEST_DIR)/include/gtest/internal/*.h
|
|
||||||
|
|
||||||
# House-keeping build targets.
|
|
||||||
|
|
||||||
all : $(TESTS) $(TEXTTESTS)
|
|
||||||
|
|
||||||
clean :
|
|
||||||
rm -f $(TESTS) $(TEXTTESTS) gtest.a gtest_main.a *.o
|
|
||||||
|
|
||||||
# Builds gtest.a and gtest_main.a.
|
|
||||||
|
|
||||||
# Usually you shouldn't tweak such internal variables, indicated by a
|
|
||||||
# trailing _.
|
|
||||||
GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)
|
|
||||||
|
|
||||||
# For simplicity and to avoid depending on Google Test's
|
|
||||||
# implementation details, the dependencies specified below are
|
|
||||||
# conservative and not optimized. This is fine as Google Test
|
|
||||||
# compiles fast and for ordinary users its source rarely changes.
|
|
||||||
gtest-all.o : $(GTEST_SRCS_)
|
|
||||||
$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \
|
|
||||||
$(GTEST_DIR)/src/gtest-all.cc
|
|
||||||
|
|
||||||
gtest_main.o : $(GTEST_SRCS_)
|
|
||||||
$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \
|
|
||||||
$(GTEST_DIR)/src/gtest_main.cc
|
|
||||||
|
|
||||||
gtest.a : gtest-all.o
|
|
||||||
$(AR) $(ARFLAGS) $@ $^
|
|
||||||
|
|
||||||
gtest_main.a : gtest-all.o gtest_main.o
|
|
||||||
$(AR) $(ARFLAGS) $@ $^
|
|
||||||
|
|
||||||
# Builds a sample test. A test should link with gtest.a, and also
|
|
||||||
# gtest_main.a if it doesn't define its own main() function.
|
|
||||||
|
|
||||||
GildedRose.o : $(USER_DIR)/GildedRose.cc
|
|
||||||
$(CXX) -c $^
|
|
||||||
|
|
||||||
GildedRoseUnitTests.o : $(USER_DIR)/GildedRoseUnitTests.cc \
|
|
||||||
$(GTEST_HEADERS)
|
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/GildedRoseUnitTests.cc
|
|
||||||
|
|
||||||
GildedRose : GildedRoseUnitTests.o GildedRose.o gtest.a gtest_main.a
|
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -pthread $^ -o $@
|
|
||||||
|
|
||||||
GildedRoseTextTests.o : $(USER_DIR)/GildedRoseTextTests.cc
|
|
||||||
$(CXX) -c $^
|
|
||||||
|
|
||||||
GildedRoseTextTests : GildedRoseTextTests.o GildedRose.o
|
|
||||||
$(CXX) -pthread $^ -o $@
|
|
||||||
38
cpp/README
38
cpp/README
@ -1,38 +0,0 @@
|
|||||||
TL;DR;
|
|
||||||
-------
|
|
||||||
run-once.sh runs your tests once
|
|
||||||
|
|
||||||
Before this will work you will need:
|
|
||||||
- make and a C++ compiler (like gcc) is installed on your system and is in the PATH
|
|
||||||
- The GTest framework in the directory gtest.
|
|
||||||
- If your IDE does the compilation and linking, you should remove the first 3 lines
|
|
||||||
in the run-once.sh file.
|
|
||||||
|
|
||||||
More Verbose Instructions
|
|
||||||
-------------------------
|
|
||||||
|
|
||||||
Create a clone of both GildedRose-Refactoring-Kata and googletest in a directory we'll call ${ROOT_INSTALL_DIR}:
|
|
||||||
|
|
||||||
cd ${ROOT_INSTALL_DIR}
|
|
||||||
git clone https://github.com/emilybache/GildedRose-Refactoring-Kata
|
|
||||||
git clone https://github.com/google/googletest
|
|
||||||
|
|
||||||
Make googletest by running make in subfolder googletest/googletest/make:
|
|
||||||
|
|
||||||
cd googletest/googletest/make
|
|
||||||
make
|
|
||||||
|
|
||||||
Create a softlink in the GildedRose-Refactoring-Kata clone pointing at the googletest code:
|
|
||||||
|
|
||||||
cd ${ROOT_INSTALL_DIR}/GildedRose-Refactoring-Kata/cpp
|
|
||||||
ln -s ${ROOT_INSTALL_DIR}/googletest/googletest gtest
|
|
||||||
|
|
||||||
Make the GildedRose-Refactoring-Kata:
|
|
||||||
|
|
||||||
make
|
|
||||||
|
|
||||||
Then you should be able to run the tests:
|
|
||||||
|
|
||||||
./run_once.sh
|
|
||||||
|
|
||||||
If you have been successful, then you should see a failing test, "GildedRoseTest.Foo".
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
rm GildedRose
|
|
||||||
rm GildedRose.o
|
|
||||||
make
|
|
||||||
./GildedRose
|
|
||||||
299
csharp/.gitignore
vendored
299
csharp/.gitignore
vendored
@ -1,299 +0,0 @@
|
|||||||
## Ignore Visual Studio temporary files, build results, and
|
|
||||||
## files generated by popular Visual Studio add-ons.
|
|
||||||
##
|
|
||||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
|
||||||
|
|
||||||
# User-specific files
|
|
||||||
*.suo
|
|
||||||
*.user
|
|
||||||
*.userosscache
|
|
||||||
*.sln.docstates
|
|
||||||
|
|
||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
|
||||||
*.userprefs
|
|
||||||
|
|
||||||
# Build results
|
|
||||||
[Dd]ebug/
|
|
||||||
[Dd]ebugPublic/
|
|
||||||
[Rr]elease/
|
|
||||||
[Rr]eleases/
|
|
||||||
x64/
|
|
||||||
x86/
|
|
||||||
bld/
|
|
||||||
[Bb]in/
|
|
||||||
[Oo]bj/
|
|
||||||
[Ll]og/
|
|
||||||
|
|
||||||
# Visual Studio 2015 cache/options directory
|
|
||||||
.vs/
|
|
||||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
|
||||||
#wwwroot/
|
|
||||||
|
|
||||||
# MSTest test Results
|
|
||||||
[Tt]est[Rr]esult*/
|
|
||||||
[Bb]uild[Ll]og.*
|
|
||||||
|
|
||||||
# NUNIT
|
|
||||||
*.VisualState.xml
|
|
||||||
TestResult.xml
|
|
||||||
|
|
||||||
# Build Results of an ATL Project
|
|
||||||
[Dd]ebugPS/
|
|
||||||
[Rr]eleasePS/
|
|
||||||
dlldata.c
|
|
||||||
|
|
||||||
# Benchmark Results
|
|
||||||
BenchmarkDotNet.Artifacts/
|
|
||||||
|
|
||||||
# .NET Core
|
|
||||||
project.lock.json
|
|
||||||
project.fragment.lock.json
|
|
||||||
artifacts/
|
|
||||||
**/Properties/launchSettings.json
|
|
||||||
|
|
||||||
*_i.c
|
|
||||||
*_p.c
|
|
||||||
*_i.h
|
|
||||||
*.ilk
|
|
||||||
*.meta
|
|
||||||
*.obj
|
|
||||||
*.pch
|
|
||||||
*.pdb
|
|
||||||
*.pgc
|
|
||||||
*.pgd
|
|
||||||
*.rsp
|
|
||||||
*.sbr
|
|
||||||
*.tlb
|
|
||||||
*.tli
|
|
||||||
*.tlh
|
|
||||||
*.tmp
|
|
||||||
*.tmp_proj
|
|
||||||
*.log
|
|
||||||
*.vspscc
|
|
||||||
*.vssscc
|
|
||||||
.builds
|
|
||||||
*.pidb
|
|
||||||
*.svclog
|
|
||||||
*.scc
|
|
||||||
|
|
||||||
# Chutzpah Test files
|
|
||||||
_Chutzpah*
|
|
||||||
|
|
||||||
# Visual C++ cache files
|
|
||||||
ipch/
|
|
||||||
*.aps
|
|
||||||
*.ncb
|
|
||||||
*.opendb
|
|
||||||
*.opensdf
|
|
||||||
*.sdf
|
|
||||||
*.cachefile
|
|
||||||
*.VC.db
|
|
||||||
*.VC.VC.opendb
|
|
||||||
|
|
||||||
# Visual Studio profiler
|
|
||||||
*.psess
|
|
||||||
*.vsp
|
|
||||||
*.vspx
|
|
||||||
*.sap
|
|
||||||
|
|
||||||
# TFS 2012 Local Workspace
|
|
||||||
$tf/
|
|
||||||
|
|
||||||
# Guidance Automation Toolkit
|
|
||||||
*.gpState
|
|
||||||
|
|
||||||
# ReSharper is a .NET coding add-in
|
|
||||||
_ReSharper*/
|
|
||||||
*.[Rr]e[Ss]harper
|
|
||||||
*.DotSettings.user
|
|
||||||
|
|
||||||
# JustCode is a .NET coding add-in
|
|
||||||
.JustCode
|
|
||||||
|
|
||||||
# TeamCity is a build add-in
|
|
||||||
_TeamCity*
|
|
||||||
|
|
||||||
# DotCover is a Code Coverage Tool
|
|
||||||
*.dotCover
|
|
||||||
|
|
||||||
# AxoCover is a Code Coverage Tool
|
|
||||||
.axoCover/*
|
|
||||||
!.axoCover/settings.json
|
|
||||||
|
|
||||||
# Visual Studio code coverage results
|
|
||||||
*.coverage
|
|
||||||
*.coveragexml
|
|
||||||
|
|
||||||
# NCrunch
|
|
||||||
_NCrunch_*
|
|
||||||
.*crunch*.local.xml
|
|
||||||
nCrunchTemp_*
|
|
||||||
|
|
||||||
# MightyMoose
|
|
||||||
*.mm.*
|
|
||||||
AutoTest.Net/
|
|
||||||
|
|
||||||
# Web workbench (sass)
|
|
||||||
.sass-cache/
|
|
||||||
|
|
||||||
# Installshield output folder
|
|
||||||
[Ee]xpress/
|
|
||||||
|
|
||||||
# DocProject is a documentation generator add-in
|
|
||||||
DocProject/buildhelp/
|
|
||||||
DocProject/Help/*.HxT
|
|
||||||
DocProject/Help/*.HxC
|
|
||||||
DocProject/Help/*.hhc
|
|
||||||
DocProject/Help/*.hhk
|
|
||||||
DocProject/Help/*.hhp
|
|
||||||
DocProject/Help/Html2
|
|
||||||
DocProject/Help/html
|
|
||||||
|
|
||||||
# Click-Once directory
|
|
||||||
publish/
|
|
||||||
|
|
||||||
# Publish Web Output
|
|
||||||
*.[Pp]ublish.xml
|
|
||||||
*.azurePubxml
|
|
||||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
|
||||||
# but database connection strings (with potential passwords) will be unencrypted
|
|
||||||
*.pubxml
|
|
||||||
*.publishproj
|
|
||||||
|
|
||||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
|
||||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
|
||||||
# in these scripts will be unencrypted
|
|
||||||
PublishScripts/
|
|
||||||
|
|
||||||
# NuGet Packages
|
|
||||||
*.nupkg
|
|
||||||
# The packages folder can be ignored because of Package Restore
|
|
||||||
**/packages/*
|
|
||||||
# except build/, which is used as an MSBuild target.
|
|
||||||
!**/packages/build/
|
|
||||||
# Uncomment if necessary however generally it will be regenerated when needed
|
|
||||||
#!**/packages/repositories.config
|
|
||||||
# NuGet v3's project.json files produces more ignorable files
|
|
||||||
*.nuget.props
|
|
||||||
*.nuget.targets
|
|
||||||
|
|
||||||
# Microsoft Azure Build Output
|
|
||||||
csx/
|
|
||||||
*.build.csdef
|
|
||||||
|
|
||||||
# Microsoft Azure Emulator
|
|
||||||
ecf/
|
|
||||||
rcf/
|
|
||||||
|
|
||||||
# Windows Store app package directories and files
|
|
||||||
AppPackages/
|
|
||||||
BundleArtifacts/
|
|
||||||
Package.StoreAssociation.xml
|
|
||||||
_pkginfo.txt
|
|
||||||
*.appx
|
|
||||||
|
|
||||||
# Visual Studio cache files
|
|
||||||
# files ending in .cache can be ignored
|
|
||||||
*.[Cc]ache
|
|
||||||
# but keep track of directories ending in .cache
|
|
||||||
!*.[Cc]ache/
|
|
||||||
|
|
||||||
# Others
|
|
||||||
ClientBin/
|
|
||||||
~$*
|
|
||||||
*~
|
|
||||||
*.dbmdl
|
|
||||||
*.dbproj.schemaview
|
|
||||||
*.jfm
|
|
||||||
*.pfx
|
|
||||||
*.publishsettings
|
|
||||||
orleans.codegen.cs
|
|
||||||
|
|
||||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
|
||||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
|
||||||
#bower_components/
|
|
||||||
|
|
||||||
# RIA/Silverlight projects
|
|
||||||
Generated_Code/
|
|
||||||
|
|
||||||
# Backup & report files from converting an old project file
|
|
||||||
# to a newer Visual Studio version. Backup files are not needed,
|
|
||||||
# because we have git ;-)
|
|
||||||
_UpgradeReport_Files/
|
|
||||||
Backup*/
|
|
||||||
UpgradeLog*.XML
|
|
||||||
UpgradeLog*.htm
|
|
||||||
|
|
||||||
# SQL Server files
|
|
||||||
*.mdf
|
|
||||||
*.ldf
|
|
||||||
*.ndf
|
|
||||||
|
|
||||||
# Business Intelligence projects
|
|
||||||
*.rdl.data
|
|
||||||
*.bim.layout
|
|
||||||
*.bim_*.settings
|
|
||||||
|
|
||||||
# Microsoft Fakes
|
|
||||||
FakesAssemblies/
|
|
||||||
|
|
||||||
# GhostDoc plugin setting file
|
|
||||||
*.GhostDoc.xml
|
|
||||||
|
|
||||||
# Node.js Tools for Visual Studio
|
|
||||||
.ntvs_analysis.dat
|
|
||||||
node_modules/
|
|
||||||
|
|
||||||
# Typescript v1 declaration files
|
|
||||||
typings/
|
|
||||||
|
|
||||||
# Visual Studio 6 build log
|
|
||||||
*.plg
|
|
||||||
|
|
||||||
# Visual Studio 6 workspace options file
|
|
||||||
*.opt
|
|
||||||
|
|
||||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
|
||||||
*.vbw
|
|
||||||
|
|
||||||
# Visual Studio LightSwitch build output
|
|
||||||
**/*.HTMLClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/ModelManifest.xml
|
|
||||||
**/*.Server/GeneratedArtifacts
|
|
||||||
**/*.Server/ModelManifest.xml
|
|
||||||
_Pvt_Extensions
|
|
||||||
|
|
||||||
# Paket dependency manager
|
|
||||||
.paket/paket.exe
|
|
||||||
paket-files/
|
|
||||||
|
|
||||||
# FAKE - F# Make
|
|
||||||
.fake/
|
|
||||||
|
|
||||||
# JetBrains Rider
|
|
||||||
.idea/
|
|
||||||
*.sln.iml
|
|
||||||
|
|
||||||
# CodeRush
|
|
||||||
.cr/
|
|
||||||
|
|
||||||
# Python Tools for Visual Studio (PTVS)
|
|
||||||
__pycache__/
|
|
||||||
*.pyc
|
|
||||||
|
|
||||||
# Cake - Uncomment if you are using it
|
|
||||||
# tools/**
|
|
||||||
# !tools/packages.config
|
|
||||||
|
|
||||||
# Tabs Studio
|
|
||||||
*.tss
|
|
||||||
|
|
||||||
# Telerik's JustMock configuration file
|
|
||||||
*.jmconfig
|
|
||||||
|
|
||||||
# BizTalk build output
|
|
||||||
*.btp.cs
|
|
||||||
*.btm.cs
|
|
||||||
*.odx.cs
|
|
||||||
*.xsd.cs
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<startup>
|
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
|
||||||
</startup>
|
|
||||||
</configuration>
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
using NUnit.Framework;
|
|
||||||
|
|
||||||
namespace csharp
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class ApprovalTest
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void ThirtyDays()
|
|
||||||
{
|
|
||||||
var lines = File.ReadAllLines("ThirtyDays.txt");
|
|
||||||
|
|
||||||
StringBuilder fakeoutput = new StringBuilder();
|
|
||||||
Console.SetOut(new StringWriter(fakeoutput));
|
|
||||||
Console.SetIn(new StringReader("a\n"));
|
|
||||||
|
|
||||||
Program.Main(new string[] { });
|
|
||||||
String output = fakeoutput.ToString();
|
|
||||||
|
|
||||||
var outputLines = output.Split('\n');
|
|
||||||
for(var i = 0; i<Math.Min(lines.Length, outputLines.Length); i++)
|
|
||||||
{
|
|
||||||
Assert.AreEqual(lines[i], outputLines[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,89 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace csharp
|
|
||||||
{
|
|
||||||
public class GildedRose
|
|
||||||
{
|
|
||||||
IList<Item> Items;
|
|
||||||
public GildedRose(IList<Item> Items)
|
|
||||||
{
|
|
||||||
this.Items = Items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateQuality()
|
|
||||||
{
|
|
||||||
for (var i = 0; i < Items.Count; 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,18 +0,0 @@
|
|||||||
using NUnit.Framework;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace csharp
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class GildedRoseTest
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void foo()
|
|
||||||
{
|
|
||||||
IList<Item> Items = new List<Item> { new Item { Name = "foo", SellIn = 0, Quality = 0 } };
|
|
||||||
GildedRose app = new GildedRose(Items);
|
|
||||||
app.UpdateQuality();
|
|
||||||
Assert.AreEqual("fixme", Items[0].Name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
namespace csharp
|
|
||||||
{
|
|
||||||
public class Item
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
public int SellIn { get; set; }
|
|
||||||
public int Quality { get; set; }
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return this.Name + ", " + this.SellIn + ", " + this.Quality;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace csharp
|
|
||||||
{
|
|
||||||
public class Program
|
|
||||||
{
|
|
||||||
public static void Main(string[] args)
|
|
||||||
{
|
|
||||||
Console.WriteLine("OMGHAI!");
|
|
||||||
|
|
||||||
IList<Item> Items = new List<Item>{
|
|
||||||
new Item {Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20},
|
|
||||||
new Item {Name = "Aged Brie", SellIn = 2, Quality = 0},
|
|
||||||
new Item {Name = "Elixir of the Mongoose", SellIn = 5, Quality = 7},
|
|
||||||
new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80},
|
|
||||||
new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = -1, Quality = 80},
|
|
||||||
new Item
|
|
||||||
{
|
|
||||||
Name = "Backstage passes to a TAFKAL80ETC concert",
|
|
||||||
SellIn = 15,
|
|
||||||
Quality = 20
|
|
||||||
},
|
|
||||||
new Item
|
|
||||||
{
|
|
||||||
Name = "Backstage passes to a TAFKAL80ETC concert",
|
|
||||||
SellIn = 10,
|
|
||||||
Quality = 49
|
|
||||||
},
|
|
||||||
new Item
|
|
||||||
{
|
|
||||||
Name = "Backstage passes to a TAFKAL80ETC concert",
|
|
||||||
SellIn = 5,
|
|
||||||
Quality = 49
|
|
||||||
},
|
|
||||||
// this conjured item does not work properly yet
|
|
||||||
new Item {Name = "Conjured Mana Cake", SellIn = 3, Quality = 6}
|
|
||||||
};
|
|
||||||
|
|
||||||
var app = new GildedRose(Items);
|
|
||||||
|
|
||||||
|
|
||||||
for (var i = 0; i < 31; i++)
|
|
||||||
{
|
|
||||||
Console.WriteLine("-------- day " + i + " --------");
|
|
||||||
Console.WriteLine("name, sellIn, quality");
|
|
||||||
for (var j = 0; j < Items.Count; j++)
|
|
||||||
{
|
|
||||||
System.Console.WriteLine(Items[j]);
|
|
||||||
}
|
|
||||||
Console.WriteLine("");
|
|
||||||
app.UpdateQuality();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("csharp")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("csharp")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("176c0214-9136-4079-8dab-11d7420c3881")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
||||||
@ -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,97 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="packages\NUnit3TestAdapter.3.9.0\build\net35\NUnit3TestAdapter.props" Condition="Exists('packages\NUnit3TestAdapter.3.9.0\build\net35\NUnit3TestAdapter.props')" />
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{176C0214-9136-4079-8DAB-11D7420C3881}</ProjectGuid>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>csharp</RootNamespace>
|
|
||||||
<AssemblyName>csharp</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
|
||||||
<NuGetPackageImportStamp>
|
|
||||||
</NuGetPackageImportStamp>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="ApprovalTests, Version=3.0.0.0, Culture=neutral, PublicKeyToken=11bd7d124fc62e0f, processorArchitecture=MSIL">
|
|
||||||
<HintPath>packages\ApprovalTests.3.0.13\lib\net40\ApprovalTests.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="ApprovalUtilities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=11bd7d124fc62e0f, processorArchitecture=MSIL">
|
|
||||||
<HintPath>packages\ApprovalUtilities.3.0.13\lib\net45\ApprovalUtilities.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="ApprovalUtilities.Net45, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>packages\ApprovalUtilities.3.0.13\lib\net45\ApprovalUtilities.Net45.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="nunit.framework, Version=3.9.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
|
||||||
<HintPath>packages\NUnit.3.9.0\lib\net45\nunit.framework.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="ApprovalTest.cs" />
|
|
||||||
<Compile Include="GildedRose.cs" />
|
|
||||||
<Compile Include="GildedRoseTest.cs" />
|
|
||||||
<Compile Include="Item.cs" />
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="App.config" />
|
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="ThirtyDays.txt">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
|
||||||
<PropertyGroup>
|
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Error Condition="!Exists('packages\NUnit3TestAdapter.3.9.0\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\NUnit3TestAdapter.3.9.0\build\net35\NUnit3TestAdapter.props'))" />
|
|
||||||
</Target>
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio 14
|
|
||||||
VisualStudioVersion = 14.0.25420.1
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp", "csharp.csproj", "{176C0214-9136-4079-8DAB-11D7420C3881}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{176C0214-9136-4079-8DAB-11D7420C3881}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{176C0214-9136-4079-8DAB-11D7420C3881}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{176C0214-9136-4079-8DAB-11D7420C3881}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{176C0214-9136-4079-8DAB-11D7420C3881}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="ApprovalTests" version="3.0.13" targetFramework="net452" />
|
|
||||||
<package id="ApprovalUtilities" version="3.0.13" targetFramework="net452" />
|
|
||||||
<package id="NUnit" version="3.9.0" targetFramework="net452" />
|
|
||||||
<package id="NUnit3TestAdapter" version="3.9.0" targetFramework="net452" />
|
|
||||||
</packages>
|
|
||||||
300
csharpcore/.gitignore
vendored
300
csharpcore/.gitignore
vendored
@ -1,300 +0,0 @@
|
|||||||
## Ignore Visual Studio temporary files, build results, and
|
|
||||||
## files generated by popular Visual Studio add-ons.
|
|
||||||
##
|
|
||||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
|
||||||
|
|
||||||
# User-specific files
|
|
||||||
*.suo
|
|
||||||
*.user
|
|
||||||
*.userosscache
|
|
||||||
*.sln.docstates
|
|
||||||
|
|
||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
|
||||||
*.userprefs
|
|
||||||
|
|
||||||
# Build results
|
|
||||||
[Dd]ebug/
|
|
||||||
[Dd]ebugPublic/
|
|
||||||
[Rr]elease/
|
|
||||||
[Rr]eleases/
|
|
||||||
x64/
|
|
||||||
x86/
|
|
||||||
bld/
|
|
||||||
[Bb]in/
|
|
||||||
[Oo]bj/
|
|
||||||
[Ll]og/
|
|
||||||
|
|
||||||
# Visual Studio 2015 cache/options directory
|
|
||||||
.vs/
|
|
||||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
|
||||||
#wwwroot/
|
|
||||||
|
|
||||||
# MSTest test Results
|
|
||||||
[Tt]est[Rr]esult*/
|
|
||||||
[Bb]uild[Ll]og.*
|
|
||||||
|
|
||||||
# NUNIT
|
|
||||||
*.VisualState.xml
|
|
||||||
TestResult.xml
|
|
||||||
|
|
||||||
# Build Results of an ATL Project
|
|
||||||
[Dd]ebugPS/
|
|
||||||
[Rr]eleasePS/
|
|
||||||
dlldata.c
|
|
||||||
|
|
||||||
# Benchmark Results
|
|
||||||
BenchmarkDotNet.Artifacts/
|
|
||||||
|
|
||||||
# .NET Core
|
|
||||||
project.lock.json
|
|
||||||
project.fragment.lock.json
|
|
||||||
artifacts/
|
|
||||||
**/Properties/launchSettings.json
|
|
||||||
|
|
||||||
*_i.c
|
|
||||||
*_p.c
|
|
||||||
*_i.h
|
|
||||||
*.ilk
|
|
||||||
*.meta
|
|
||||||
*.obj
|
|
||||||
*.pch
|
|
||||||
*.pdb
|
|
||||||
*.pgc
|
|
||||||
*.pgd
|
|
||||||
*.rsp
|
|
||||||
*.sbr
|
|
||||||
*.tlb
|
|
||||||
*.tli
|
|
||||||
*.tlh
|
|
||||||
*.tmp
|
|
||||||
*.tmp_proj
|
|
||||||
*.log
|
|
||||||
*.vspscc
|
|
||||||
*.vssscc
|
|
||||||
.builds
|
|
||||||
*.pidb
|
|
||||||
*.svclog
|
|
||||||
*.scc
|
|
||||||
|
|
||||||
# Chutzpah Test files
|
|
||||||
_Chutzpah*
|
|
||||||
|
|
||||||
# Visual C++ cache files
|
|
||||||
ipch/
|
|
||||||
*.aps
|
|
||||||
*.ncb
|
|
||||||
*.opendb
|
|
||||||
*.opensdf
|
|
||||||
*.sdf
|
|
||||||
*.cachefile
|
|
||||||
*.VC.db
|
|
||||||
*.VC.VC.opendb
|
|
||||||
|
|
||||||
# Visual Studio profiler
|
|
||||||
*.psess
|
|
||||||
*.vsp
|
|
||||||
*.vspx
|
|
||||||
*.sap
|
|
||||||
|
|
||||||
# TFS 2012 Local Workspace
|
|
||||||
$tf/
|
|
||||||
|
|
||||||
# Guidance Automation Toolkit
|
|
||||||
*.gpState
|
|
||||||
|
|
||||||
# ReSharper is a .NET coding add-in
|
|
||||||
_ReSharper*/
|
|
||||||
*.[Rr]e[Ss]harper
|
|
||||||
*.DotSettings.user
|
|
||||||
|
|
||||||
# JustCode is a .NET coding add-in
|
|
||||||
.JustCode
|
|
||||||
|
|
||||||
# TeamCity is a build add-in
|
|
||||||
_TeamCity*
|
|
||||||
|
|
||||||
# DotCover is a Code Coverage Tool
|
|
||||||
*.dotCover
|
|
||||||
|
|
||||||
# AxoCover is a Code Coverage Tool
|
|
||||||
.axoCover/*
|
|
||||||
!.axoCover/settings.json
|
|
||||||
|
|
||||||
# Visual Studio code coverage results
|
|
||||||
*.coverage
|
|
||||||
*.coveragexml
|
|
||||||
|
|
||||||
# NCrunch
|
|
||||||
_NCrunch_*
|
|
||||||
.*crunch*.local.xml
|
|
||||||
nCrunchTemp_*
|
|
||||||
|
|
||||||
# MightyMoose
|
|
||||||
*.mm.*
|
|
||||||
AutoTest.Net/
|
|
||||||
|
|
||||||
# Web workbench (sass)
|
|
||||||
.sass-cache/
|
|
||||||
|
|
||||||
# Installshield output folder
|
|
||||||
[Ee]xpress/
|
|
||||||
|
|
||||||
# DocProject is a documentation generator add-in
|
|
||||||
DocProject/buildhelp/
|
|
||||||
DocProject/Help/*.HxT
|
|
||||||
DocProject/Help/*.HxC
|
|
||||||
DocProject/Help/*.hhc
|
|
||||||
DocProject/Help/*.hhk
|
|
||||||
DocProject/Help/*.hhp
|
|
||||||
DocProject/Help/Html2
|
|
||||||
DocProject/Help/html
|
|
||||||
|
|
||||||
# Click-Once directory
|
|
||||||
publish/
|
|
||||||
|
|
||||||
# Publish Web Output
|
|
||||||
*.[Pp]ublish.xml
|
|
||||||
*.azurePubxml
|
|
||||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
|
||||||
# but database connection strings (with potential passwords) will be unencrypted
|
|
||||||
*.pubxml
|
|
||||||
*.publishproj
|
|
||||||
|
|
||||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
|
||||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
|
||||||
# in these scripts will be unencrypted
|
|
||||||
PublishScripts/
|
|
||||||
|
|
||||||
# NuGet Packages
|
|
||||||
*.nupkg
|
|
||||||
# The packages folder can be ignored because of Package Restore
|
|
||||||
**/packages/*
|
|
||||||
# except build/, which is used as an MSBuild target.
|
|
||||||
!**/packages/build/
|
|
||||||
# Uncomment if necessary however generally it will be regenerated when needed
|
|
||||||
#!**/packages/repositories.config
|
|
||||||
# NuGet v3's project.json files produces more ignorable files
|
|
||||||
*.nuget.props
|
|
||||||
*.nuget.targets
|
|
||||||
|
|
||||||
# Microsoft Azure Build Output
|
|
||||||
csx/
|
|
||||||
*.build.csdef
|
|
||||||
|
|
||||||
# Microsoft Azure Emulator
|
|
||||||
ecf/
|
|
||||||
rcf/
|
|
||||||
|
|
||||||
# Windows Store app package directories and files
|
|
||||||
AppPackages/
|
|
||||||
BundleArtifacts/
|
|
||||||
Package.StoreAssociation.xml
|
|
||||||
_pkginfo.txt
|
|
||||||
*.appx
|
|
||||||
|
|
||||||
# Visual Studio cache files
|
|
||||||
# files ending in .cache can be ignored
|
|
||||||
*.[Cc]ache
|
|
||||||
# but keep track of directories ending in .cache
|
|
||||||
!*.[Cc]ache/
|
|
||||||
|
|
||||||
# Others
|
|
||||||
ClientBin/
|
|
||||||
~$*
|
|
||||||
*~
|
|
||||||
*.dbmdl
|
|
||||||
*.dbproj.schemaview
|
|
||||||
*.jfm
|
|
||||||
*.pfx
|
|
||||||
*.publishsettings
|
|
||||||
orleans.codegen.cs
|
|
||||||
|
|
||||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
|
||||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
|
||||||
#bower_components/
|
|
||||||
|
|
||||||
# RIA/Silverlight projects
|
|
||||||
Generated_Code/
|
|
||||||
|
|
||||||
# Backup & report files from converting an old project file
|
|
||||||
# to a newer Visual Studio version. Backup files are not needed,
|
|
||||||
# because we have git ;-)
|
|
||||||
_UpgradeReport_Files/
|
|
||||||
Backup*/
|
|
||||||
UpgradeLog*.XML
|
|
||||||
UpgradeLog*.htm
|
|
||||||
|
|
||||||
# SQL Server files
|
|
||||||
*.mdf
|
|
||||||
*.ldf
|
|
||||||
*.ndf
|
|
||||||
|
|
||||||
# Business Intelligence projects
|
|
||||||
*.rdl.data
|
|
||||||
*.bim.layout
|
|
||||||
*.bim_*.settings
|
|
||||||
|
|
||||||
# Microsoft Fakes
|
|
||||||
FakesAssemblies/
|
|
||||||
|
|
||||||
# GhostDoc plugin setting file
|
|
||||||
*.GhostDoc.xml
|
|
||||||
|
|
||||||
# Node.js Tools for Visual Studio
|
|
||||||
.ntvs_analysis.dat
|
|
||||||
node_modules/
|
|
||||||
|
|
||||||
# Typescript v1 declaration files
|
|
||||||
typings/
|
|
||||||
|
|
||||||
# Visual Studio 6 build log
|
|
||||||
*.plg
|
|
||||||
|
|
||||||
# Visual Studio 6 workspace options file
|
|
||||||
*.opt
|
|
||||||
|
|
||||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
|
||||||
*.vbw
|
|
||||||
|
|
||||||
# Visual Studio LightSwitch build output
|
|
||||||
**/*.HTMLClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/ModelManifest.xml
|
|
||||||
**/*.Server/GeneratedArtifacts
|
|
||||||
**/*.Server/ModelManifest.xml
|
|
||||||
_Pvt_Extensions
|
|
||||||
|
|
||||||
# Paket dependency manager
|
|
||||||
.paket/paket.exe
|
|
||||||
paket-files/
|
|
||||||
|
|
||||||
# FAKE - F# Make
|
|
||||||
.fake/
|
|
||||||
|
|
||||||
# JetBrains Rider
|
|
||||||
.idea/
|
|
||||||
*.sln.iml
|
|
||||||
|
|
||||||
# CodeRush
|
|
||||||
.cr/
|
|
||||||
|
|
||||||
# Python Tools for Visual Studio (PTVS)
|
|
||||||
__pycache__/
|
|
||||||
*.pyc
|
|
||||||
|
|
||||||
# Cake - Uncomment if you are using it
|
|
||||||
# tools/**
|
|
||||||
# !tools/packages.config
|
|
||||||
|
|
||||||
# Tabs Studio
|
|
||||||
*.tss
|
|
||||||
|
|
||||||
# Telerik's JustMock configuration file
|
|
||||||
*.jmconfig
|
|
||||||
|
|
||||||
# BizTalk build output
|
|
||||||
*.btp.cs
|
|
||||||
*.btm.cs
|
|
||||||
*.odx.cs
|
|
||||||
*.xsd.cs
|
|
||||||
.vscode
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
using Xunit;
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace csharpcore
|
|
||||||
{
|
|
||||||
public class ApprovalTest
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void ThirtyDays()
|
|
||||||
{
|
|
||||||
var lines = File.ReadAllLines("ThirtyDays.txt");
|
|
||||||
|
|
||||||
StringBuilder fakeoutput = new StringBuilder();
|
|
||||||
Console.SetOut(new StringWriter(fakeoutput));
|
|
||||||
Console.SetIn(new StringReader("a\n"));
|
|
||||||
|
|
||||||
Program.Main(new string[] { });
|
|
||||||
String output = fakeoutput.ToString();
|
|
||||||
|
|
||||||
var outputLines = output.Split('\n');
|
|
||||||
for(var i = 0; i<Math.Min(lines.Length, outputLines.Length); i++)
|
|
||||||
{
|
|
||||||
Assert.Equal(lines[i], outputLines[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,89 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace csharpcore
|
|
||||||
{
|
|
||||||
public class GildedRose
|
|
||||||
{
|
|
||||||
IList<Item> Items;
|
|
||||||
public GildedRose(IList<Item> Items)
|
|
||||||
{
|
|
||||||
this.Items = Items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateQuality()
|
|
||||||
{
|
|
||||||
for (var i = 0; i < Items.Count; 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,17 +0,0 @@
|
|||||||
using Xunit;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace csharpcore
|
|
||||||
{
|
|
||||||
public class GildedRoseTest
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void foo()
|
|
||||||
{
|
|
||||||
IList<Item> Items = new List<Item> { new Item { Name = "foo", SellIn = 0, Quality = 0 } };
|
|
||||||
GildedRose app = new GildedRose(Items);
|
|
||||||
app.UpdateQuality();
|
|
||||||
Assert.Equal("fixme", Items[0].Name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
namespace csharpcore
|
|
||||||
{
|
|
||||||
public class Item
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
public int SellIn { get; set; }
|
|
||||||
public int Quality { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace csharpcore
|
|
||||||
{
|
|
||||||
public class Program
|
|
||||||
{
|
|
||||||
public static void Main(string[] args)
|
|
||||||
{
|
|
||||||
Console.WriteLine("OMGHAI!");
|
|
||||||
|
|
||||||
IList<Item> Items = new List<Item>{
|
|
||||||
new Item {Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20},
|
|
||||||
new Item {Name = "Aged Brie", SellIn = 2, Quality = 0},
|
|
||||||
new Item {Name = "Elixir of the Mongoose", SellIn = 5, Quality = 7},
|
|
||||||
new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80},
|
|
||||||
new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = -1, Quality = 80},
|
|
||||||
new Item
|
|
||||||
{
|
|
||||||
Name = "Backstage passes to a TAFKAL80ETC concert",
|
|
||||||
SellIn = 15,
|
|
||||||
Quality = 20
|
|
||||||
},
|
|
||||||
new Item
|
|
||||||
{
|
|
||||||
Name = "Backstage passes to a TAFKAL80ETC concert",
|
|
||||||
SellIn = 10,
|
|
||||||
Quality = 49
|
|
||||||
},
|
|
||||||
new Item
|
|
||||||
{
|
|
||||||
Name = "Backstage passes to a TAFKAL80ETC concert",
|
|
||||||
SellIn = 5,
|
|
||||||
Quality = 49
|
|
||||||
},
|
|
||||||
// this conjured item does not work properly yet
|
|
||||||
new Item {Name = "Conjured Mana Cake", SellIn = 3, Quality = 6}
|
|
||||||
};
|
|
||||||
|
|
||||||
var app = new GildedRose(Items);
|
|
||||||
|
|
||||||
|
|
||||||
for (var i = 0; i < 31; i++)
|
|
||||||
{
|
|
||||||
Console.WriteLine("-------- day " + i + " --------");
|
|
||||||
Console.WriteLine("name, sellIn, quality");
|
|
||||||
for (var j = 0; j < Items.Count; j++)
|
|
||||||
{
|
|
||||||
System.Console.WriteLine(Items[j].Name + ", " + Items[j].SellIn + ", " + Items[j].Quality);
|
|
||||||
}
|
|
||||||
Console.WriteLine("");
|
|
||||||
app.UpdateQuality();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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,17 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
|
||||||
<StartupObject>csharpcore.Program</StartupObject>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
|
|
||||||
<PackageReference Include="xunit" Version="2.3.1" />
|
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
|
|
||||||
<None Update="ThirtyDays.txt" CopyToOutputDirectory="PreserveNewest" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
6
dart/.gitignore
vendored
6
dart/.gitignore
vendored
@ -1,6 +0,0 @@
|
|||||||
# Files and directories created by pub
|
|
||||||
.packages
|
|
||||||
.pub/
|
|
||||||
packages
|
|
||||||
pubspec.lock # (Remove this pattern if you wish to check in your lock file)
|
|
||||||
.idea
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
import 'package:gilded_rose/gilded_rose.dart';
|
|
||||||
|
|
||||||
main(List<String> args) {
|
|
||||||
print("OMGHAI!");
|
|
||||||
|
|
||||||
var 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)
|
|
||||||
];
|
|
||||||
|
|
||||||
GildedRose app = new GildedRose(items);
|
|
||||||
|
|
||||||
int days = 2;
|
|
||||||
if (args.length > 0) {
|
|
||||||
days = int.parse(args[0]) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < days; i++) {
|
|
||||||
print("-------- day $i --------");
|
|
||||||
print("name, sellIn, quality");
|
|
||||||
for (var item in items) {
|
|
||||||
print(item);
|
|
||||||
}
|
|
||||||
print('');
|
|
||||||
app.updateQuality();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
class GildedRose {
|
|
||||||
List<Item> items;
|
|
||||||
|
|
||||||
GildedRose(this.items);
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Item {
|
|
||||||
String name;
|
|
||||||
int sellIn;
|
|
||||||
int quality;
|
|
||||||
|
|
||||||
Item(this.name, this.sellIn, this.quality);
|
|
||||||
|
|
||||||
String toString() => '$name, $sellIn, $quality';
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
name: gilded_rose
|
|
||||||
version: 0.0.1
|
|
||||||
description: A simple console application.
|
|
||||||
|
|
||||||
dev_dependencies:
|
|
||||||
test: '>=0.12.11 <0.13.0'
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
import 'package:test/test.dart';
|
|
||||||
import 'package:gilded_rose/gilded_rose.dart';
|
|
||||||
|
|
||||||
main() {
|
|
||||||
test('foo', () {
|
|
||||||
var item = new Item('foo', 0, 0);
|
|
||||||
var items = <Item>[item];
|
|
||||||
|
|
||||||
GildedRose app = new GildedRose(items);
|
|
||||||
app.updateQuality();
|
|
||||||
expect("fixme", app.items[0].name);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
use Mix.Config
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user