mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-21 09:21:08 +00:00
Resolve merge conflicts
This commit is contained in:
commit
6d56da9b59
8
.github/pull_request_template.md
vendored
Normal file
8
.github/pull_request_template.md
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# READ ME BEFORE SUBMITTING A PR
|
||||
|
||||
Please do not submit a PR with your solution to the Gilded Rose Kata. This repo is intended to be used as a starting point for the kata.
|
||||
|
||||
- [ ] I acknowledge that this PR is not a solution to the Gilded Rose Kata, but an improvement to the template.
|
||||
- [ ] I acknowledge that I have read [CONTRIBUTING.md](https://github.com/emilybache/GildedRose-Refactoring-Kata/blob/main/CONTRIBUTING.md)
|
||||
|
||||
## Please provide your PR description below this line
|
||||
39
.github/workflows/jq.yml
vendored
Normal file
39
.github/workflows/jq.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
name: jq
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- jq/*
|
||||
|
||||
jobs:
|
||||
test-jq-translation:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Rust Toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
# TODO: this step takes ~2m, consider using https://github.com/marketplace/actions/cargo-install
|
||||
- name: Install jaq
|
||||
run: |
|
||||
cargo install --locked --git https://github.com/01mf02/jaq
|
||||
|
||||
- name: Expect unit test to fail
|
||||
working-directory: jq
|
||||
run: |
|
||||
! ./test-gilded-rose.sh
|
||||
|
||||
- name: Expect texttest fixture output (aka 'verify')
|
||||
working-directory: jq
|
||||
run: |
|
||||
jaq --arg days 31 -nr "$(cat gilded-rose.jq) $(cat texttest_fixture.jq)" |
|
||||
diff - ../texttests/ThirtyDays/stdout.gr
|
||||
36
.github/workflows/pr-validation.yml
vendored
Normal file
36
.github/workflows/pr-validation.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
name: "PR Tasks Completed Check"
|
||||
on:
|
||||
pull_request:
|
||||
types: opened
|
||||
|
||||
jobs:
|
||||
task-check:
|
||||
# Only run from the base repository
|
||||
if: github.event.repository.name == 'emilybache/GildedRose-Refactoring-Kata'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Comment if checkmark is missing
|
||||
if: ${{ !contains(github.event.pull_request.body, '[X] I acknowledge') }}
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: "Please don't submit a Pull Request containing a Kata solution to the original repo from Emily Bache. If you are instead trying to add an improvement, please resubmit this PR and check the `[X]` box in the PR template."
|
||||
})
|
||||
- name: Close PR if checkmark is missing
|
||||
if: ${{ !contains(github.event.pull_request.body, '[X] I acknowledge') }}
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
github.rest.pulls.update({
|
||||
pull_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
state: 'closed'
|
||||
})
|
||||
14
.gitignore
vendored
14
.gitignore
vendored
@ -1,5 +1,19 @@
|
||||
<<<<<<< HEAD
|
||||
*.pyc
|
||||
.cache
|
||||
.coverage
|
||||
.idea/
|
||||
*.iml
|
||||
=======
|
||||
bin
|
||||
obj
|
||||
*.sln.DotSettings.user
|
||||
.vs
|
||||
vendor
|
||||
.idea
|
||||
*.iml
|
||||
**/*.received.*
|
||||
venv
|
||||
**/DS_Store/*
|
||||
**/.DS_Store/*
|
||||
>>>>>>> e2abba77cb5a395702f237e428b639f2129b1f07
|
||||
|
||||
6
Ada/.gitignore
vendored
Normal file
6
Ada/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
*.o
|
||||
*.ali
|
||||
b~*.ads
|
||||
b~*.adb
|
||||
program
|
||||
gilded_rose_tester
|
||||
23
Ada/Makefile
Normal file
23
Ada/Makefile
Normal file
@ -0,0 +1,23 @@
|
||||
AHVEN_INCLUDE:=-aI/usr/share/ada/adainclude/ahven -aI/usr/include/ahven
|
||||
AHVEN_LIBS:=-aO/usr/lib/x86_64-linux-gnu/ada/adalib/ahven -aO/usr/lib/ahven -aO/usr/lib -shared
|
||||
ADAFLAGS:=-gnat2012 $(AHVEN_INCLUDE) $(AHVEN_LIBS)
|
||||
LIBS:=-largs -lahven
|
||||
|
||||
.PHONY: all
|
||||
all: gilded_rose_tester program
|
||||
|
||||
.PHONY: gilded_rose_tester
|
||||
gilded_rose_tester:
|
||||
@gnatmake -q $(ADAFLAGS) gilded_rose_tester $(LIBS)
|
||||
|
||||
.PHONY: test
|
||||
test: gilded_rose_tester
|
||||
@./gilded_rose_tester
|
||||
|
||||
.PHONY: program
|
||||
program:
|
||||
@gnatmake -q $(ADAFLAGS) program $(LIBS)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@gnatclean -q gilded_rose_tester program
|
||||
8
Ada/README.txt
Normal file
8
Ada/README.txt
Normal file
@ -0,0 +1,8 @@
|
||||
You will need the following programs:
|
||||
|
||||
- GNU make (on Debian-like systems do 'apt-get install make')
|
||||
- gcc with Ada enabled ('apt-get install gnat')
|
||||
- the ahven unit-test framework ('apt-get install libahven5-dev')
|
||||
|
||||
'make test' runs your tests once.
|
||||
|
||||
373
Ada/ThirtyDays.txt
Normal file
373
Ada/ThirtyDays.txt
Normal file
@ -0,0 +1,373 @@
|
||||
OMGHAI!
|
||||
-------- day 0 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, 10, 20
|
||||
Aged Brie, 2, 0
|
||||
Elixir of the Mongoose, 5, 7
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 15, 20
|
||||
Backstage passes to a TAFKAL80ETC concert, 10, 49
|
||||
Backstage passes to a TAFKAL80ETC concert, 5, 49
|
||||
Conjured Mana Cake, 3, 6
|
||||
|
||||
-------- day 1 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, 9, 19
|
||||
Aged Brie, 1, 1
|
||||
Elixir of the Mongoose, 4, 6
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 14, 21
|
||||
Backstage passes to a TAFKAL80ETC concert, 9, 50
|
||||
Backstage passes to a TAFKAL80ETC concert, 4, 50
|
||||
Conjured Mana Cake, 2, 5
|
||||
|
||||
-------- day 2 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, 8, 18
|
||||
Aged Brie, 0, 2
|
||||
Elixir of the Mongoose, 3, 5
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 13, 22
|
||||
Backstage passes to a TAFKAL80ETC concert, 8, 50
|
||||
Backstage passes to a TAFKAL80ETC concert, 3, 50
|
||||
Conjured Mana Cake, 1, 4
|
||||
|
||||
-------- day 3 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, 7, 17
|
||||
Aged Brie, -1, 4
|
||||
Elixir of the Mongoose, 2, 4
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 12, 23
|
||||
Backstage passes to a TAFKAL80ETC concert, 7, 50
|
||||
Backstage passes to a TAFKAL80ETC concert, 2, 50
|
||||
Conjured Mana Cake, 0, 3
|
||||
|
||||
-------- day 4 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, 6, 16
|
||||
Aged Brie, -2, 6
|
||||
Elixir of the Mongoose, 1, 3
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 11, 24
|
||||
Backstage passes to a TAFKAL80ETC concert, 6, 50
|
||||
Backstage passes to a TAFKAL80ETC concert, 1, 50
|
||||
Conjured Mana Cake, -1, 1
|
||||
|
||||
-------- day 5 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, 5, 15
|
||||
Aged Brie, -3, 8
|
||||
Elixir of the Mongoose, 0, 2
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 10, 25
|
||||
Backstage passes to a TAFKAL80ETC concert, 5, 50
|
||||
Backstage passes to a TAFKAL80ETC concert, 0, 50
|
||||
Conjured Mana Cake, -2, 0
|
||||
|
||||
-------- day 6 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, 4, 14
|
||||
Aged Brie, -4, 10
|
||||
Elixir of the Mongoose, -1, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 9, 27
|
||||
Backstage passes to a TAFKAL80ETC concert, 4, 50
|
||||
Backstage passes to a TAFKAL80ETC concert, -1, 0
|
||||
Conjured Mana Cake, -3, 0
|
||||
|
||||
-------- day 7 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, 3, 13
|
||||
Aged Brie, -5, 12
|
||||
Elixir of the Mongoose, -2, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 8, 29
|
||||
Backstage passes to a TAFKAL80ETC concert, 3, 50
|
||||
Backstage passes to a TAFKAL80ETC concert, -2, 0
|
||||
Conjured Mana Cake, -4, 0
|
||||
|
||||
-------- day 8 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, 2, 12
|
||||
Aged Brie, -6, 14
|
||||
Elixir of the Mongoose, -3, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 7, 31
|
||||
Backstage passes to a TAFKAL80ETC concert, 2, 50
|
||||
Backstage passes to a TAFKAL80ETC concert, -3, 0
|
||||
Conjured Mana Cake, -5, 0
|
||||
|
||||
-------- day 9 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, 1, 11
|
||||
Aged Brie, -7, 16
|
||||
Elixir of the Mongoose, -4, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 6, 33
|
||||
Backstage passes to a TAFKAL80ETC concert, 1, 50
|
||||
Backstage passes to a TAFKAL80ETC concert, -4, 0
|
||||
Conjured Mana Cake, -6, 0
|
||||
|
||||
-------- day 10 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, 0, 10
|
||||
Aged Brie, -8, 18
|
||||
Elixir of the Mongoose, -5, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 5, 35
|
||||
Backstage passes to a TAFKAL80ETC concert, 0, 50
|
||||
Backstage passes to a TAFKAL80ETC concert, -5, 0
|
||||
Conjured Mana Cake, -7, 0
|
||||
|
||||
-------- day 11 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -1, 8
|
||||
Aged Brie, -9, 20
|
||||
Elixir of the Mongoose, -6, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 4, 38
|
||||
Backstage passes to a TAFKAL80ETC concert, -1, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -6, 0
|
||||
Conjured Mana Cake, -8, 0
|
||||
|
||||
-------- day 12 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -2, 6
|
||||
Aged Brie, -10, 22
|
||||
Elixir of the Mongoose, -7, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 3, 41
|
||||
Backstage passes to a TAFKAL80ETC concert, -2, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -7, 0
|
||||
Conjured Mana Cake, -9, 0
|
||||
|
||||
-------- day 13 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -3, 4
|
||||
Aged Brie, -11, 24
|
||||
Elixir of the Mongoose, -8, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 2, 44
|
||||
Backstage passes to a TAFKAL80ETC concert, -3, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -8, 0
|
||||
Conjured Mana Cake, -10, 0
|
||||
|
||||
-------- day 14 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -4, 2
|
||||
Aged Brie, -12, 26
|
||||
Elixir of the Mongoose, -9, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 1, 47
|
||||
Backstage passes to a TAFKAL80ETC concert, -4, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -9, 0
|
||||
Conjured Mana Cake, -11, 0
|
||||
|
||||
-------- day 15 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -5, 0
|
||||
Aged Brie, -13, 28
|
||||
Elixir of the Mongoose, -10, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, 0, 50
|
||||
Backstage passes to a TAFKAL80ETC concert, -5, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -10, 0
|
||||
Conjured Mana Cake, -12, 0
|
||||
|
||||
-------- day 16 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -6, 0
|
||||
Aged Brie, -14, 30
|
||||
Elixir of the Mongoose, -11, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, -1, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -6, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -11, 0
|
||||
Conjured Mana Cake, -13, 0
|
||||
|
||||
-------- day 17 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -7, 0
|
||||
Aged Brie, -15, 32
|
||||
Elixir of the Mongoose, -12, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, -2, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -7, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -12, 0
|
||||
Conjured Mana Cake, -14, 0
|
||||
|
||||
-------- day 18 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -8, 0
|
||||
Aged Brie, -16, 34
|
||||
Elixir of the Mongoose, -13, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, -3, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -8, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -13, 0
|
||||
Conjured Mana Cake, -15, 0
|
||||
|
||||
-------- day 19 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -9, 0
|
||||
Aged Brie, -17, 36
|
||||
Elixir of the Mongoose, -14, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, -4, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -9, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -14, 0
|
||||
Conjured Mana Cake, -16, 0
|
||||
|
||||
-------- day 20 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -10, 0
|
||||
Aged Brie, -18, 38
|
||||
Elixir of the Mongoose, -15, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, -5, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -10, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -15, 0
|
||||
Conjured Mana Cake, -17, 0
|
||||
|
||||
-------- day 21 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -11, 0
|
||||
Aged Brie, -19, 40
|
||||
Elixir of the Mongoose, -16, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, -6, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -11, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -16, 0
|
||||
Conjured Mana Cake, -18, 0
|
||||
|
||||
-------- day 22 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -12, 0
|
||||
Aged Brie, -20, 42
|
||||
Elixir of the Mongoose, -17, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, -7, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -12, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -17, 0
|
||||
Conjured Mana Cake, -19, 0
|
||||
|
||||
-------- day 23 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -13, 0
|
||||
Aged Brie, -21, 44
|
||||
Elixir of the Mongoose, -18, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, -8, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -13, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -18, 0
|
||||
Conjured Mana Cake, -20, 0
|
||||
|
||||
-------- day 24 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -14, 0
|
||||
Aged Brie, -22, 46
|
||||
Elixir of the Mongoose, -19, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, -9, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -14, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -19, 0
|
||||
Conjured Mana Cake, -21, 0
|
||||
|
||||
-------- day 25 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -15, 0
|
||||
Aged Brie, -23, 48
|
||||
Elixir of the Mongoose, -20, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, -10, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -15, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -20, 0
|
||||
Conjured Mana Cake, -22, 0
|
||||
|
||||
-------- day 26 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -16, 0
|
||||
Aged Brie, -24, 50
|
||||
Elixir of the Mongoose, -21, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, -11, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -16, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -21, 0
|
||||
Conjured Mana Cake, -23, 0
|
||||
|
||||
-------- day 27 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -17, 0
|
||||
Aged Brie, -25, 50
|
||||
Elixir of the Mongoose, -22, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, -12, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -17, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -22, 0
|
||||
Conjured Mana Cake, -24, 0
|
||||
|
||||
-------- day 28 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -18, 0
|
||||
Aged Brie, -26, 50
|
||||
Elixir of the Mongoose, -23, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, -13, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -18, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -23, 0
|
||||
Conjured Mana Cake, -25, 0
|
||||
|
||||
-------- day 29 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -19, 0
|
||||
Aged Brie, -27, 50
|
||||
Elixir of the Mongoose, -24, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, -14, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -19, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -24, 0
|
||||
Conjured Mana Cake, -26, 0
|
||||
|
||||
-------- day 30 --------
|
||||
name, sellIn, quality
|
||||
+5 Dexterity Vest, -20, 0
|
||||
Aged Brie, -28, 50
|
||||
Elixir of the Mongoose, -25, 0
|
||||
Sulfuras, Hand of Ragnaros, 0, 80
|
||||
Sulfuras, Hand of Ragnaros, -1, 80
|
||||
Backstage passes to a TAFKAL80ETC concert, -15, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -20, 0
|
||||
Backstage passes to a TAFKAL80ETC concert, -25, 0
|
||||
Conjured Mana Cake, -27, 0
|
||||
|
||||
62
Ada/gilded_rose.adb
Normal file
62
Ada/gilded_rose.adb
Normal file
@ -0,0 +1,62 @@
|
||||
with Ada.Strings.Unbounded;
|
||||
use Ada.Strings.Unbounded;
|
||||
|
||||
package body Gilded_Rose is
|
||||
procedure Update_Quality(Self : in out Gilded_Rose) is
|
||||
Cursor : Item_Vecs.Cursor := Item_Vecs.First(Self.Items);
|
||||
begin
|
||||
while Item_Vecs.Has_Element(Cursor) loop
|
||||
if Self.Items(Cursor).Name /= To_Unbounded_String("Aged Brie")
|
||||
and Self.Items(Cursor).Name /= To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert") then
|
||||
if Self.Items(Cursor).Quality > 0 then
|
||||
if Self.Items(Cursor).Name /= To_Unbounded_String("Sulfuras, Hand of Ragnaros") then
|
||||
Self.Items(Cursor).Quality := Self.Items(Cursor).Quality - 1;
|
||||
end if;
|
||||
end if;
|
||||
else
|
||||
if Self.Items(Cursor).Quality < 50 then
|
||||
Self.Items(Cursor).Quality := Self.Items(Cursor).Quality + 1;
|
||||
|
||||
if Self.Items(Cursor).Name = To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert") then
|
||||
if Self.Items(Cursor).Sell_In < 11 then
|
||||
if Self.Items(Cursor).Quality < 50 then
|
||||
Self.Items(Cursor).Quality := Self.Items(Cursor).Quality + 1;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
if Self.Items(Cursor).Sell_In < 6 then
|
||||
if Self.Items(Cursor).Quality < 50 then
|
||||
Self.Items(Cursor).Quality := Self.Items(Cursor).Quality + 1;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
if Self.Items(Cursor).Name /= To_Unbounded_String("Sulfuras, Hand of Ragnaros") then
|
||||
Self.Items(Cursor).Sell_In := Self.Items(Cursor).Sell_In - 1;
|
||||
end if;
|
||||
|
||||
if Self.Items(Cursor).Sell_In < 0 then
|
||||
if Self.Items(Cursor).Name /= To_Unbounded_String("Aged Brie") then
|
||||
if Self.Items(Cursor).Name /= To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert") then
|
||||
if Self.Items(Cursor).Quality > 0 then
|
||||
if Self.Items(Cursor).Name /= To_Unbounded_String("Sulfuras, Hand of Ragnaros") then
|
||||
Self.Items(Cursor).Quality := Self.Items(Cursor).Quality - 1;
|
||||
end if;
|
||||
end if;
|
||||
else
|
||||
Self.Items(Cursor).Quality := Self.Items(Cursor).Quality - Self.Items(Cursor).Quality;
|
||||
end if;
|
||||
else
|
||||
if Self.Items(Cursor).Quality < 50 then
|
||||
Self.Items(Cursor).Quality := Self.Items(Cursor).Quality + 1;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
Item_Vecs.Next(Cursor);
|
||||
end loop;
|
||||
end;
|
||||
|
||||
end Gilded_Rose;
|
||||
15
Ada/gilded_rose.ads
Normal file
15
Ada/gilded_rose.ads
Normal file
@ -0,0 +1,15 @@
|
||||
with Ada.Containers.Vectors;
|
||||
with Items;
|
||||
use Items;
|
||||
|
||||
package Gilded_Rose is
|
||||
package Item_Vecs is new Ada.Containers.Vectors (
|
||||
Element_Type => Item,
|
||||
Index_Type => Positive
|
||||
);
|
||||
|
||||
type Gilded_Rose is record
|
||||
Items : Item_Vecs.Vector;
|
||||
end record;
|
||||
procedure Update_Quality(Self : in out Gilded_Rose);
|
||||
end Gilded_Rose;
|
||||
10
Ada/gilded_rose_tester.adb
Normal file
10
Ada/gilded_rose_tester.adb
Normal file
@ -0,0 +1,10 @@
|
||||
with Ahven.Text_Runner;
|
||||
with Ahven.Framework;
|
||||
with Gilded_Rose_Tests;
|
||||
|
||||
procedure Gilded_Rose_Tester is
|
||||
S : Ahven.Framework.Test_Suite := Ahven.Framework.Create_Suite("All");
|
||||
begin
|
||||
Ahven.Framework.Add_Test(S, new Gilded_Rose_Tests.Test);
|
||||
Ahven.Text_Runner.Run(S);
|
||||
end Gilded_Rose_Tester;
|
||||
38
Ada/gilded_rose_tests.adb
Normal file
38
Ada/gilded_rose_tests.adb
Normal file
@ -0,0 +1,38 @@
|
||||
with Gilded_Rose;
|
||||
use Gilded_Rose;
|
||||
|
||||
with Items;
|
||||
use Items;
|
||||
|
||||
with Ahven;
|
||||
|
||||
with Ada.Strings.Unbounded;
|
||||
|
||||
package body Gilded_Rose_Tests is
|
||||
procedure Initialize(T : in out Test) is
|
||||
begin
|
||||
Set_Name(T, "Gilded_Rose_Test");
|
||||
Ahven.Framework.Add_Test_Routine(T, Test_Gilded_Rose'Access, "Foo");
|
||||
end Initialize;
|
||||
|
||||
procedure Test_Gilded_Rose is
|
||||
Things : Item_Vecs.Vector;
|
||||
begin
|
||||
Things.Append(New_Item =>
|
||||
(Name => SU.To_Unbounded_String("Foo"),
|
||||
Sell_In => 0,
|
||||
Quality => 0));
|
||||
declare
|
||||
App : Gilded_Rose.Gilded_Rose := (Items => Things);
|
||||
|
||||
package SU renames Ada.Strings.Unbounded;
|
||||
procedure Assert_Eq_Unbounded_String is
|
||||
new Ahven.Assert_Equal(Data_Type => SU.Unbounded_String, Image => SU.To_String);
|
||||
begin
|
||||
Update_Quality(App);
|
||||
Assert_Eq_Unbounded_String(Actual => App.Items(Item_Vecs.First(App.Items)).Name,
|
||||
Expected => SU.To_Unbounded_String("fixme"),
|
||||
Message => "fixme");
|
||||
end;
|
||||
end;
|
||||
end Gilded_Rose_Tests;
|
||||
11
Ada/gilded_rose_tests.ads
Normal file
11
Ada/gilded_rose_tests.ads
Normal file
@ -0,0 +1,11 @@
|
||||
with Ahven.Framework;
|
||||
|
||||
package Gilded_Rose_Tests is
|
||||
type Test is new Ahven.Framework.Test_Case with null record;
|
||||
|
||||
procedure Initialize(T : in out Test);
|
||||
|
||||
private
|
||||
|
||||
procedure Test_Gilded_Rose;
|
||||
end Gilded_Rose_Tests;
|
||||
31
Ada/items.adb
Normal file
31
Ada/items.adb
Normal file
@ -0,0 +1,31 @@
|
||||
with Ada.Strings.Unbounded;
|
||||
use Ada.Strings.Unbounded;
|
||||
|
||||
package body Items is
|
||||
function Integer_Image(Self : in Integer) return String is
|
||||
Img : constant String := Integer'Image(Self);
|
||||
begin
|
||||
if Self < 0 then
|
||||
return Img;
|
||||
else
|
||||
return Img(2 .. Img'Length);
|
||||
end if;
|
||||
end;
|
||||
|
||||
function To_String(Self : in Item) return String is
|
||||
Name : constant Unbounded_String := Self.Name;
|
||||
Sell_In : constant Unbounded_String := To_Unbounded_String(Integer_Image(Self.Sell_In));
|
||||
Quality : constant Unbounded_String := To_Unbounded_String(Integer_Image(Self.Quality));
|
||||
|
||||
Ret : Unbounded_String;
|
||||
begin
|
||||
Append(Ret, Name);
|
||||
Append(Ret, ", ");
|
||||
Append(Ret, Sell_In);
|
||||
Append(Ret, ", ");
|
||||
Append(Ret, Quality);
|
||||
|
||||
return To_String(Ret);
|
||||
end;
|
||||
|
||||
end Items;
|
||||
14
Ada/items.ads
Normal file
14
Ada/items.ads
Normal file
@ -0,0 +1,14 @@
|
||||
with Ada.Strings.Unbounded;
|
||||
|
||||
package Items is
|
||||
package SU renames Ada.Strings.Unbounded;
|
||||
|
||||
type Item is record
|
||||
Name : SU.Unbounded_String;
|
||||
Sell_In : Integer;
|
||||
Quality : Integer;
|
||||
end record;
|
||||
|
||||
function To_String(Self : in Item) return String;
|
||||
|
||||
end Items;
|
||||
72
Ada/program.adb
Normal file
72
Ada/program.adb
Normal file
@ -0,0 +1,72 @@
|
||||
with Ada.Text_IO;
|
||||
use Ada.Text_IO;
|
||||
|
||||
with Items;
|
||||
use Items;
|
||||
|
||||
with Ada.Strings.Unbounded;
|
||||
use Ada.Strings.Unbounded;
|
||||
|
||||
with Gilded_Rose;
|
||||
use Gilded_Rose;
|
||||
|
||||
procedure Program is
|
||||
Things : Item_Vecs.Vector;
|
||||
begin
|
||||
Things.Append(New_Item =>
|
||||
(Name => To_Unbounded_String("+5 Dexterity Vest"),
|
||||
Sell_In => 10,
|
||||
Quality => 20));
|
||||
Things.Append(New_Item =>
|
||||
(Name => To_Unbounded_String("Aged Brie"),
|
||||
Sell_In => 2,
|
||||
Quality => 0));
|
||||
Things.Append(New_Item =>
|
||||
(Name => To_Unbounded_String("Elixir of the Mongoose"),
|
||||
Sell_In => 5,
|
||||
Quality => 7));
|
||||
Things.Append(New_Item =>
|
||||
(Name => To_Unbounded_String("Sulfuras, Hand of Ragnaros"),
|
||||
Sell_In => 0,
|
||||
Quality => 80));
|
||||
Things.Append(New_Item =>
|
||||
(Name => To_Unbounded_String("Sulfuras, Hand of Ragnaros"),
|
||||
Sell_In => -1,
|
||||
Quality => 80));
|
||||
Things.Append(New_Item =>
|
||||
(Name => To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert"),
|
||||
Sell_In => 15,
|
||||
Quality => 20));
|
||||
Things.Append(New_Item =>
|
||||
(Name => To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert"),
|
||||
Sell_In => 10,
|
||||
Quality => 49));
|
||||
Things.Append(New_Item =>
|
||||
(Name => To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert"),
|
||||
Sell_In => 5,
|
||||
Quality => 49));
|
||||
-- this conjured item does not work properly yet
|
||||
Things.Append(New_Item =>
|
||||
(Name => To_Unbounded_String("Conjured Mana Cake"),
|
||||
Sell_In => 3,
|
||||
Quality => 6));
|
||||
|
||||
|
||||
declare
|
||||
App : Gilded_Rose.Gilded_Rose := (Items => Things);
|
||||
begin
|
||||
Put_Line("OMGHAI!");
|
||||
|
||||
for I in 0 .. 30 loop
|
||||
Put_Line("-------- day" & Integer'Image(I) & " --------");
|
||||
Put_Line("name, sellIn, quality");
|
||||
|
||||
for Each of App.Items loop
|
||||
Put_Line(To_String(Each));
|
||||
end loop;
|
||||
Put_Line("");
|
||||
|
||||
Update_Quality(App);
|
||||
end loop;
|
||||
end;
|
||||
end;
|
||||
98
C/GildedRose.c
Normal file
98
C/GildedRose.c
Normal file
@ -0,0 +1,98 @@
|
||||
#include <string.h>
|
||||
#include "GildedRose.h"
|
||||
#include <stdio.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;
|
||||
}
|
||||
|
||||
extern char*
|
||||
print_item(char* buffer, Item* item)
|
||||
{
|
||||
sprintf(buffer, "%s, %d, %d", item->name, item->sellIn, item->quality);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
C/GildedRose.h
Normal file
15
C/GildedRose.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef ROSE_INCLUDED
|
||||
#define ROSE_INCLUDED
|
||||
|
||||
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);
|
||||
extern char* print_item(char* buffer, Item* item);
|
||||
|
||||
#endif
|
||||
43
C/GildedRoseTextTests.c
Normal file
43
C/GildedRoseTextTests.c
Normal file
@ -0,0 +1,43 @@
|
||||
#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;
|
||||
}
|
||||
43
C/GildedRoseUnitTests.cc
Normal file
43
C/GildedRoseUnitTests.cc
Normal file
@ -0,0 +1,43 @@
|
||||
#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[1];
|
||||
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
Normal file
51
C/Makefile
Normal file
@ -0,0 +1,51 @@
|
||||
# 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.txt
Normal file
5
C/README.txt
Normal file
@ -0,0 +1,5 @@
|
||||
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
|
||||
2
C/run-once.sh
Executable file
2
C/run-once.sh
Executable file
@ -0,0 +1,2 @@
|
||||
make
|
||||
./GildedRoseTextTests
|
||||
1
COBOL/Gnu/.gitignore
vendored
Normal file
1
COBOL/Gnu/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.so
|
||||
38
COBOL/Gnu/Add.cbl
Normal file
38
COBOL/Gnu/Add.cbl
Normal file
@ -0,0 +1,38 @@
|
||||
program-id. Add as "Add".
|
||||
|
||||
environment division.
|
||||
|
||||
input-output section.
|
||||
|
||||
file-control.
|
||||
select in-items assign 'in-items'.
|
||||
|
||||
data division.
|
||||
file section.
|
||||
fd in-items.
|
||||
01 item.
|
||||
02 sell-in pic s9(2).
|
||||
02 quality pic s9(2).
|
||||
02 name pic x(50).
|
||||
|
||||
working-storage section.
|
||||
01 accept-item.
|
||||
02 sell-in pic s9(2).
|
||||
02 quality pic s9(2).
|
||||
02 name pic x(50).
|
||||
|
||||
|
||||
procedure division.
|
||||
open extend in-items.
|
||||
display "name"
|
||||
accept name in accept-item.
|
||||
display "sell-in"
|
||||
accept sell-in in accept-item.
|
||||
display "quality"
|
||||
accept quality in accept-item.
|
||||
move accept-item to item.
|
||||
write item.
|
||||
close in-items.
|
||||
goback.
|
||||
|
||||
end program Add.
|
||||
77
COBOL/Gnu/GildedRose.cbl
Normal file
77
COBOL/Gnu/GildedRose.cbl
Normal file
@ -0,0 +1,77 @@
|
||||
program-id. GildedRose as "GildedRose".
|
||||
|
||||
environment division.
|
||||
|
||||
input-output section.
|
||||
|
||||
file-control.
|
||||
select in-items assign 'in-items'.
|
||||
select items assign 'items'.
|
||||
|
||||
data division.
|
||||
file section.
|
||||
fd in-items.
|
||||
01 in-item pic x(54).
|
||||
fd items.
|
||||
01 item.
|
||||
02 sell-in pic s9(2).
|
||||
02 quality pic s9(2).
|
||||
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 > 0
|
||||
if name not equal to "Sulfuras, Hand of Ragnaros"
|
||||
compute quality = quality - 1
|
||||
end-if
|
||||
end-if
|
||||
else
|
||||
if quality < 50
|
||||
compute quality = quality + 1
|
||||
if name equals "Backstage passes to a TAFKAL80ETC concert"
|
||||
if sell-in < 11
|
||||
if quality < 50
|
||||
compute quality = quality + 1
|
||||
end-if
|
||||
end-if
|
||||
if sell-in < 6
|
||||
if quality < 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 < 0
|
||||
if name is not equal to "Aged Brie"
|
||||
if name is not equal to "Backstage passes to a TAFKAL80ETC concert"
|
||||
if quality > 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 < 50
|
||||
compute quality = quality + 1
|
||||
end-if
|
||||
end-if
|
||||
end-if
|
||||
write item.
|
||||
go to start-lable.
|
||||
end-lable.
|
||||
close items.
|
||||
close in-items.
|
||||
goback.
|
||||
|
||||
end program GildedRose.
|
||||
2
COBOL/Gnu/add.sh
Executable file
2
COBOL/Gnu/add.sh
Executable file
@ -0,0 +1,2 @@
|
||||
touch in-items
|
||||
cobcrun Add
|
||||
1
COBOL/Gnu/build.sh
Executable file
1
COBOL/Gnu/build.sh
Executable file
@ -0,0 +1 @@
|
||||
cobc --free --std=mf -O *.cbl
|
||||
1
COBOL/Gnu/run.sh
Executable file
1
COBOL/Gnu/run.sh
Executable file
@ -0,0 +1 @@
|
||||
cobcrun GildedRose
|
||||
2
COBOL/Gnu/test.sh
Executable file
2
COBOL/Gnu/test.sh
Executable file
@ -0,0 +1,2 @@
|
||||
./build.sh
|
||||
./run.sh
|
||||
169
COBOL/mf/src/.cobolProj
Normal file
169
COBOL/mf/src/.cobolProj
Normal file
@ -0,0 +1,169 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="cobolProject" name="Gilded Rose" uuid="3529a385-3bb5-4b82-9b84-9e384fb2bdd4" version="4.0">
|
||||
<settings xsi:type="projectSettingsContainer">
|
||||
<copybook-paths xsi:type="copybookPathsSettings">
|
||||
<path enabled="true" name="/Gilded Rose" type="mfpath"/>
|
||||
</copybook-paths>
|
||||
<build-precedence-paths xsi:type="buildPrecedenceSettings">
|
||||
<path enabled="true" name="/Gilded Rose" type="mfpath"/>
|
||||
</build-precedence-paths>
|
||||
<configurations default="Gilded Rose" linkedWith="2017" xsi:type="buildConfigurationsContainer">
|
||||
<configuration description="Gilded Rose" type="all_intgnt" is64bit="false" createlbr="false" platform="Windows" xsi:type="cobolBuildConfiguration">
|
||||
<targetdir name="Gilded Rose.bin"/>
|
||||
<application_configuration xsi:type="runtimeConfigurationSettings">
|
||||
<cobol_switches xsi:type="projectCobolSwitches"/>
|
||||
<rts_switches xsi:type="projectRtsSwitches"/>
|
||||
<envScriptParameters></envScriptParameters>
|
||||
<envScriptPath></envScriptPath>
|
||||
<inheritBuildEnv>false</inheritBuildEnv>
|
||||
<tunables>
|
||||
<tunable index="0" name="screen_lines" value="25"/>
|
||||
<tunable index="0" name="screen_cols" value="80"/>
|
||||
<tunable index="0" name="default_cancel_mode" value="1"/>
|
||||
<tunable index="0" name="program_search_order" value="4"/>
|
||||
<tunable index="0" name="arguments_are_initial" value="false"/>
|
||||
<tunable index="0" name="command_line_accept" value="false"/>
|
||||
<tunable index="0" name="sort_memory" value="0"/>
|
||||
<tunable index="0" name="dynamic_memory_limit" value="2147483647"/>
|
||||
<tunable index="0" name="memory_free_check_size" value="100"/>
|
||||
<tunable index="0" name="memory_strategy" value="1"/>
|
||||
<tunable index="0" name="ansi_input_mode" value="false"/>
|
||||
<tunable index="0" name="current_year" value="0"/>
|
||||
<tunable index="0" name="current_month" value="0"/>
|
||||
<tunable index="0" name="current_day" value="0"/>
|
||||
<tunable index="0" name="datewarp_dynamic" value="false"/>
|
||||
<tunable index="0" name="current_hour" value="-1"/>
|
||||
<tunable index="0" name="current_minute" value="-1"/>
|
||||
<tunable index="0" name="current_second" value="-1"/>
|
||||
<tunable index="0" name="timewarp_dynamic" value="false"/>
|
||||
</tunables>
|
||||
</application_configuration>
|
||||
<link_settings xsi:type="linkSettings">
|
||||
<additional_options value=""/>
|
||||
<rts_bind value="false"/>
|
||||
<custom_link_command value=""/>
|
||||
<debug value="false"/>
|
||||
<entry_point name=""/>
|
||||
<entry_point_runtime value="false"/>
|
||||
<error_undefined_syms value="false"/>
|
||||
<application_type value="console"/>
|
||||
<include_cpp value="false"/>
|
||||
<additional_files/>
|
||||
<rcfile path=""/>
|
||||
<rts_type value="shared"/>
|
||||
<target name="Gilded Rose"/>
|
||||
<targettype type="exe"/>
|
||||
<threaded_rts value="true"/>
|
||||
<verbose value="false"/>
|
||||
</link_settings>
|
||||
</configuration>
|
||||
</configurations>
|
||||
<cobol_settings xsi:type="cobolSettings">
|
||||
<options>
|
||||
<option name="WARNING" value="1"/>
|
||||
<option name="DIALECT" value="MF"/>
|
||||
<option name="CHARSET" value="ASCII"/>
|
||||
<option name="SOURCEFORMAT" value="free"/>
|
||||
<option name="MAX-ERROR" value="100"/>
|
||||
</options>
|
||||
<createJar value="false"/>
|
||||
<createJarAfterBuild value="false"/>
|
||||
<debug value="true"/>
|
||||
<enableCodeCoverage value="true"/>
|
||||
<enableProfiler value="false"/>
|
||||
<generate value="false"/>
|
||||
<retainDirectivesFile value="false"/>
|
||||
<genListFile value="false"/>
|
||||
<packageToFolderMapping value="false"/>
|
||||
<useJvmDynamicCalls value="false"/>
|
||||
<useJvmIncrementalBuild value="false"/>
|
||||
<verbose value="false"/>
|
||||
</cobol_settings>
|
||||
<ims_settings xsi:type="additionalImsSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
<generatedFileDir name=""/>
|
||||
<imsDatabaseDir name=""/>
|
||||
</ims_settings>
|
||||
<mfs_settings xsi:type="mfsSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/MFS/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
</mfs_settings>
|
||||
<dbd_settings xsi:type="dbdSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/DBD/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
<cleanDbdOutputFiles value="false"/>
|
||||
</dbd_settings>
|
||||
<psb_settings xsi:type="psbSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/PSB/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
<cleanPsbOutputFiles value="false"/>
|
||||
</psb_settings>
|
||||
<bms_settings xsi:type="bmsSettings">
|
||||
<options>
|
||||
<option id="dsect" name="bmsSettings" value="/SYSPARM=DSECT"/>
|
||||
<option id="decimalchar" name="bmsSettings" value="/DP=."/>
|
||||
<option id="currencychar" name="bmsSettings" value="/CS=$"/>
|
||||
<option id="sdf" name="bmsSettings" value="/IGNORE"/>
|
||||
<option id="map" name="bmsSettings" value="/SYSPARM=MAP"/>
|
||||
</options>
|
||||
</bms_settings>
|
||||
<dependent-projects xsi:type="dependentProjectsSettings"/>
|
||||
<asm_settings xsi:type="assemblerCompileSettings">
|
||||
<options>
|
||||
<option id="compile_pre_assm_macros" name="mf370chk" value="NOMPC"/>
|
||||
<option id="compile_mark_reentrant" name="mf370chk" value="RENT"/>
|
||||
<option id="compile_create_optimized_code" name="mf370chk" value="NOOPT"/>
|
||||
<option id="compile_aat_info" name="mf370chk" value="NOAAT"/>
|
||||
<option id="compile_cross_ref_listing" name="mf370chk" value="NOXREF"/>
|
||||
<option id="compile_create_debug_info" name="mf370chk" value="ANIM"/>
|
||||
<option id="compile_generate_listing" name="mf370chk" value="NOLIST"/>
|
||||
</options>
|
||||
</asm_settings>
|
||||
<asm_link_settings xsi:type="assemblerLinkSettings">
|
||||
<options>
|
||||
<option id="link_residency_mode" name="mf370lnk" value="RMODE(31)"/>
|
||||
<option id="link_linker_output" name="mf370lnk" value="OMF(390)"/>
|
||||
<option id="link_resolve_external" name="mf370lnk" value="CALL"/>
|
||||
<option id="link_mark_reusable" name="mf370lnk" value="REUS"/>
|
||||
<option id="link_generate_listing" name="mf370lnk" value="NOLIST"/>
|
||||
<option id="link_create_debug_info" name="mf370lnk" value="ANIM"/>
|
||||
<option id="link_mark_reentrant" name="mf370lnk" value="RENT"/>
|
||||
<option id="link_addressing_mode" name="mf370lnk" value="AMODE(31)"/>
|
||||
</options>
|
||||
</asm_link_settings>
|
||||
<asm_cics_settings enabled="false" xsi:type="assemblerCicsSettings">
|
||||
<options>
|
||||
<option id="cics_insert_epilog_macros" name="mf370chkCics" value="EPILOG"/>
|
||||
<option id="cics_unsupported_option" name="mf370chkCics" value="UOPT(E)"/>
|
||||
<option id="cics_insert_prolog_macros" name="mf370chkCics" value="PROLOG"/>
|
||||
<option id="cics_unsupported_function" name="mf370chkCics" value="UFUNC(E)"/>
|
||||
</options>
|
||||
</asm_cics_settings>
|
||||
<asm_autolink_settings enabled="true" xsi:type="assemblerAutoLinkSettings">
|
||||
<options>
|
||||
<option id="autolink_residency_mode" name="mf370chkAutoLink" value="RMODE(31)"/>
|
||||
<option id="autolink_mark_reusable" name="mf370chkAutoLink" value="REUS"/>
|
||||
<option id="autolink_resolve_external" name="mf370chkAutoLink" value="CALL"/>
|
||||
<option id="autolink_linker_output" name="mf370chkAutoLink" value="OMF(390)"/>
|
||||
<option id="autolink_addressing_mode" name="mf370chkAutoLink" value="AMODE(31)"/>
|
||||
</options>
|
||||
</asm_autolink_settings>
|
||||
<preprocessors_settings xsi:type="preprocessorsSettings"/>
|
||||
<code_analysis_settings enabled="false" genDataFiles="false" keepDataFiles="false" xsi:type="codeAnalysisSettings"/>
|
||||
</settings>
|
||||
<files xsi:type="projectFileStore">
|
||||
<filetype type="cobol" xsi:type="cobolFileContainer">
|
||||
<file compile="true" path="GildedRose.cbl" xsi:type="cobolFile"/>
|
||||
</filetype>
|
||||
<filetype type="cobol.copybook" xsi:type="cobolFileContainer"/>
|
||||
</files>
|
||||
</project>
|
||||
2
COBOL/mf/src/.gitignore
vendored
Normal file
2
COBOL/mf/src/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.cobolBuild
|
||||
/Gilded_Rose.bin/
|
||||
17
COBOL/mf/src/.project
Normal file
17
COBOL/mf/src/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?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>
|
||||
72
COBOL/mf/src/GildedRose.cbl
Normal file
72
COBOL/mf/src/GildedRose.cbl
Normal file
@ -0,0 +1,72 @@
|
||||
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.
|
||||
157
COBOL/mf/test/.cobolProj
Normal file
157
COBOL/mf/test/.cobolProj
Normal file
@ -0,0 +1,157 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="cobolProject" name="Tests" uuid="d5f7cafb-a22e-4fe6-9bb2-1f9a673a4e7d" version="4.0">
|
||||
<settings xsi:type="projectSettingsContainer">
|
||||
<cobol_settings xsi:type="cobolSettings">
|
||||
<options>
|
||||
<option name="WARNING" value="1"/>
|
||||
<option name="DIALECT" value="MF"/>
|
||||
<option name="CHARSET" value="ASCII"/>
|
||||
<option name="MAX-ERROR" value="100"/>
|
||||
<option name="SOURCEFORMAT" value="variable"/>
|
||||
</options>
|
||||
<createJar value="false"/>
|
||||
<createJarAfterBuild value="false"/>
|
||||
<debug value="true"/>
|
||||
<enableCodeCoverage value="true"/>
|
||||
<enableProfiler value="false"/>
|
||||
<generate value="false"/>
|
||||
<retainDirectivesFile value="false"/>
|
||||
<genListFile value="false"/>
|
||||
<packageToFolderMapping value="false"/>
|
||||
<useJvmDynamicCalls value="false"/>
|
||||
<useJvmIncrementalBuild value="false"/>
|
||||
<verbose value="false"/>
|
||||
</cobol_settings>
|
||||
<copybook-paths xsi:type="copybookPathsSettings">
|
||||
<path enabled="true" name="/Tests" type="mfpath"/>
|
||||
<path enabled="true" name="/Gilded Rose" type="mfpath"/>
|
||||
<path enabled="false" name="/Tests/Coverage" type="mfpath"/>
|
||||
</copybook-paths>
|
||||
<build-precedence-paths xsi:type="buildPrecedenceSettings">
|
||||
<path enabled="true" name="/Tests" type="mfpath"/>
|
||||
<path enabled="true" name="/Tests/Coverage" type="mfpath"/>
|
||||
</build-precedence-paths>
|
||||
<configurations default="Tests" linkedWith="2017" xsi:type="buildConfigurationsContainer">
|
||||
<configuration description="Tests" type="single_dll" is64bit="false" createlbr="false" platform="Windows" xsi:type="cobolBuildConfiguration">
|
||||
<targetdir name="Tests.bin"/>
|
||||
<application_configuration xsi:type="runtimeConfigurationSettings">
|
||||
<cobol_switches xsi:type="projectCobolSwitches"/>
|
||||
<rts_switches xsi:type="projectRtsSwitches"/>
|
||||
<envScriptParameters></envScriptParameters>
|
||||
<envScriptPath></envScriptPath>
|
||||
<inheritBuildEnv>false</inheritBuildEnv>
|
||||
<tunables>
|
||||
<tunable index="0" name="screen_lines" value="25"/>
|
||||
<tunable index="0" name="screen_cols" value="80"/>
|
||||
</tunables>
|
||||
</application_configuration>
|
||||
<link_settings xsi:type="linkSettings">
|
||||
<additional_options value=""/>
|
||||
<rts_bind value="false"/>
|
||||
<custom_link_command value=""/>
|
||||
<debug value="false"/>
|
||||
<entry_point name=""/>
|
||||
<entry_point_runtime value="false"/>
|
||||
<error_undefined_syms value="false"/>
|
||||
<application_type value="console"/>
|
||||
<include_cpp value="false"/>
|
||||
<additional_files/>
|
||||
<rcfile path=""/>
|
||||
<rts_type value="shared"/>
|
||||
<target name="Tests"/>
|
||||
<targettype type="dll/cso"/>
|
||||
<threaded_rts value="true"/>
|
||||
<verbose value="false"/>
|
||||
</link_settings>
|
||||
</configuration>
|
||||
</configurations>
|
||||
<ims_settings xsi:type="additionalImsSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
<generatedFileDir name=""/>
|
||||
<imsDatabaseDir name=""/>
|
||||
</ims_settings>
|
||||
<mfs_settings xsi:type="mfsSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/MFS/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
</mfs_settings>
|
||||
<dbd_settings xsi:type="dbdSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/DBD/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
<cleanDbdOutputFiles value="false"/>
|
||||
</dbd_settings>
|
||||
<psb_settings xsi:type="psbSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/PSB/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
<cleanPsbOutputFiles value="false"/>
|
||||
</psb_settings>
|
||||
<bms_settings xsi:type="bmsSettings">
|
||||
<options>
|
||||
<option id="dsect" name="bmsSettings" value="/SYSPARM=DSECT"/>
|
||||
<option id="decimalchar" name="bmsSettings" value="/DP=."/>
|
||||
<option id="currencychar" name="bmsSettings" value="/CS=$"/>
|
||||
<option id="sdf" name="bmsSettings" value="/IGNORE"/>
|
||||
<option id="map" name="bmsSettings" value="/SYSPARM=MAP"/>
|
||||
</options>
|
||||
</bms_settings>
|
||||
<dependent-projects xsi:type="dependentProjectsSettings">
|
||||
<dependent-project name="Gilded Rose"/>
|
||||
</dependent-projects>
|
||||
<asm_settings xsi:type="assemblerCompileSettings">
|
||||
<options>
|
||||
<option id="compile_pre_assm_macros" name="mf370chk" value="NOMPC"/>
|
||||
<option id="compile_mark_reentrant" name="mf370chk" value="RENT"/>
|
||||
<option id="compile_create_optimized_code" name="mf370chk" value="NOOPT"/>
|
||||
<option id="compile_aat_info" name="mf370chk" value="NOAAT"/>
|
||||
<option id="compile_cross_ref_listing" name="mf370chk" value="NOXREF"/>
|
||||
<option id="compile_create_debug_info" name="mf370chk" value="ANIM"/>
|
||||
<option id="compile_generate_listing" name="mf370chk" value="NOLIST"/>
|
||||
</options>
|
||||
</asm_settings>
|
||||
<asm_link_settings xsi:type="assemblerLinkSettings">
|
||||
<options>
|
||||
<option id="link_residency_mode" name="mf370lnk" value="RMODE(31)"/>
|
||||
<option id="link_linker_output" name="mf370lnk" value="OMF(390)"/>
|
||||
<option id="link_resolve_external" name="mf370lnk" value="CALL"/>
|
||||
<option id="link_mark_reusable" name="mf370lnk" value="REUS"/>
|
||||
<option id="link_generate_listing" name="mf370lnk" value="NOLIST"/>
|
||||
<option id="link_create_debug_info" name="mf370lnk" value="ANIM"/>
|
||||
<option id="link_mark_reentrant" name="mf370lnk" value="RENT"/>
|
||||
<option id="link_addressing_mode" name="mf370lnk" value="AMODE(31)"/>
|
||||
</options>
|
||||
</asm_link_settings>
|
||||
<asm_cics_settings enabled="false" xsi:type="assemblerCicsSettings">
|
||||
<options>
|
||||
<option id="cics_insert_epilog_macros" name="mf370chkCics" value="EPILOG"/>
|
||||
<option id="cics_unsupported_option" name="mf370chkCics" value="UOPT(E)"/>
|
||||
<option id="cics_insert_prolog_macros" name="mf370chkCics" value="PROLOG"/>
|
||||
<option id="cics_unsupported_function" name="mf370chkCics" value="UFUNC(E)"/>
|
||||
</options>
|
||||
</asm_cics_settings>
|
||||
<asm_autolink_settings enabled="true" xsi:type="assemblerAutoLinkSettings">
|
||||
<options>
|
||||
<option id="autolink_residency_mode" name="mf370chkAutoLink" value="RMODE(31)"/>
|
||||
<option id="autolink_mark_reusable" name="mf370chkAutoLink" value="REUS"/>
|
||||
<option id="autolink_resolve_external" name="mf370chkAutoLink" value="CALL"/>
|
||||
<option id="autolink_linker_output" name="mf370chkAutoLink" value="OMF(390)"/>
|
||||
<option id="autolink_addressing_mode" name="mf370chkAutoLink" value="AMODE(31)"/>
|
||||
</options>
|
||||
</asm_autolink_settings>
|
||||
<preprocessors_settings xsi:type="preprocessorsSettings"/>
|
||||
<code_analysis_settings enabled="false" genDataFiles="false" keepDataFiles="false" xsi:type="codeAnalysisSettings"/>
|
||||
</settings>
|
||||
<files xsi:type="projectFileStore">
|
||||
<filetype type="cobol" xsi:type="cobolFileContainer">
|
||||
<file compile="true" path="TestGildedRose.cbl" xsi:type="cobolFile"/>
|
||||
</filetype>
|
||||
<filetype type="cobol.copybook" xsi:type="cobolFileContainer"/>
|
||||
</files>
|
||||
</project>
|
||||
3
COBOL/mf/test/.gitignore
vendored
Normal file
3
COBOL/mf/test/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/.cobolBuild
|
||||
/Coverage/
|
||||
/Tests.bin/
|
||||
23
COBOL/mf/test/.project
Normal file
23
COBOL/mf/test/.project
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Tests</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.microfocus.eclipse.project.cobolBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.microfocus.eclipse.mfunit.core.mfUnitBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.microfocus.eclipse.project.cobolNature</nature>
|
||||
<nature>com.microfocus.eclipse.mfunit.core.mfUnitNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
67
COBOL/mf/test/TestGildedRose.cbl
Normal file
67
COBOL/mf/test/TestGildedRose.cbl
Normal file
@ -0,0 +1,67 @@
|
||||
*> Test Fixture for GildedRose, GildedRose
|
||||
|
||||
copy "mfunit_prototypes.cpy".
|
||||
|
||||
program-id. TestGildedRose.
|
||||
|
||||
file-control.
|
||||
select in-items assign 'in-items'.
|
||||
select items assign 'items'.
|
||||
|
||||
file section.
|
||||
fd in-items.
|
||||
01 in-item.
|
||||
02 sell-in pic 9(4).
|
||||
02 quality pic 9(4).
|
||||
02 name pic x(50).
|
||||
fd items.
|
||||
01 item.
|
||||
02 sell-in pic 9(4).
|
||||
02 quality pic 9(4).
|
||||
02 name pic x(50).
|
||||
|
||||
working-storage section.
|
||||
copy "mfunit.cpy".
|
||||
78 TEST-TESTGILDEDROSE value "TestGildedRose".
|
||||
01 pp procedure-pointer.
|
||||
|
||||
*> Program linkage data
|
||||
|
||||
procedure division.
|
||||
goback returning 0
|
||||
.
|
||||
|
||||
entry MFU-TC-PREFIX & TEST-TESTGILDEDROSE.
|
||||
open output in-items
|
||||
move "foo" to name in in-item
|
||||
move 0 to quality in in-item
|
||||
move 0 to sell-in in in-item
|
||||
write in-item
|
||||
close in-items
|
||||
call "GildedRose"
|
||||
open input items
|
||||
read items
|
||||
if name in item not equal to "fixme" then
|
||||
call MFU-ASSERT-FAIL-Z using z"item name was not fixme"
|
||||
close items
|
||||
goback
|
||||
.
|
||||
|
||||
$region TestCase Configuration
|
||||
|
||||
entry MFU-TC-SETUP-PREFIX & TEST-TESTGILDEDROSE.
|
||||
perform InitializeLinkageData
|
||||
*> Add any other test setup code here
|
||||
goback returning 0
|
||||
.
|
||||
|
||||
InitializeLinkageData section.
|
||||
*> Load the library that is being tested
|
||||
set pp to entry "GildedRose"
|
||||
|
||||
exit section
|
||||
.
|
||||
|
||||
$end-region
|
||||
|
||||
end program.
|
||||
44
CONTRIBUTING.md
Normal file
44
CONTRIBUTING.md
Normal file
@ -0,0 +1,44 @@
|
||||
Contributing to Gilded Rose Refactoring Kata
|
||||
======
|
||||
|
||||
More translations are most welcome! I'm very open for pull requests that
|
||||
translate the starting position into additional languages. However, please
|
||||
do **not** open a pull request with your solution! It can be a bit confusing since
|
||||
GitHub encourages you to do so! Please only send me pull requests if you have a
|
||||
correction or improvement to the starting position. You don't want to spoil the
|
||||
fun of doing the exercise for other people!
|
||||
|
||||
# Translating this code
|
||||
|
||||
Please note a translation should ideally include:
|
||||
|
||||
- a translation of the production code for 'update_quality' and Item
|
||||
- one failing unit test complaining that "fixme" != "foo"
|
||||
- a TextTest fixture, i.e. a command-line program that runs update_quality on the sample data for the number of days specified
|
||||
|
||||
Please don't write too much code in the starting position or add too many unit
|
||||
tests. The idea with the one failing unit test is to tempt people to work out
|
||||
how to fix it, discover it wasn't that hard, and now they understand what this
|
||||
test is doing they realize they can improve it.
|
||||
|
||||
If your programming language doesn't have an easy way to add a command-line
|
||||
interface, then the TextTest fixture is probably not necessary.
|
||||
|
||||
# Recommended project structure
|
||||
|
||||
Programming languages have a variety of conventions but the starting points try
|
||||
to maintain order among languages. Ideally, the 'update_quality' and
|
||||
Item definitions should be in a file named `gilded_rose` with your language's
|
||||
conventional casing (e.g. snake case) and location (e.g. `src/`). The "fixme" !
|
||||
= "foo" test should go in a file `gilded_rose_test` in your language's
|
||||
conventional location (e.g. `test/`). The TextTest fixture and command-line
|
||||
program, that simulates update_quality over a number of days, should go in
|
||||
`program` or `texttest_fixture`. If you can define a default for the number of
|
||||
days in the simulation please choose two days.
|
||||
|
||||
A single sub-directory per language is not enforced. A language may have
|
||||
more than one popular unit testing framework. In that case, please add
|
||||
`{language}-{framework}/` and maintain separation between the projects. In other
|
||||
words, all the components requested should exist in both sub-directories.
|
||||
Re-using code between the directories would be confusing for those looking for a
|
||||
starting point.
|
||||
17
Delphi/.gitattributes
vendored
Normal file
17
Delphi/.gitattributes
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# Set the default behavior, in case people don't have core.autocrlf set.
|
||||
* text=auto
|
||||
|
||||
# Explicitly declare text files you want to always be normalized and converted
|
||||
# to native line endings on checkout.
|
||||
*.groupproj text
|
||||
*.dpr text
|
||||
*.dproj text
|
||||
*.pas text
|
||||
*.dfm text
|
||||
*.fmx text
|
||||
|
||||
# Declare files that will always have CRLF line endings on checkout.
|
||||
|
||||
# Denote all files that are truly binary and should not be modified.
|
||||
*.exe binary
|
||||
*.res binary
|
||||
71
Delphi/.gitignore
vendored
Normal file
71
Delphi/.gitignore
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
# Uncomment these types if you want even more clean repository. But be careful.
|
||||
# It can make harm to an existing project source. Read explanations below.
|
||||
#
|
||||
# Resource files are binaries containing manifest, project icon and version info.
|
||||
# They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files.
|
||||
*.res
|
||||
#
|
||||
# Type library file (binary). In old Delphi versions it should be stored.
|
||||
# Since Delphi 2009 it is produced from .ridl file and can safely be ignored.
|
||||
#*.tlb
|
||||
#
|
||||
# Diagram Portfolio file. Used by the diagram editor up to Delphi 7.
|
||||
# Uncomment this if you are not using diagrams or use newer Delphi version.
|
||||
#*.ddp
|
||||
#
|
||||
# Visual LiveBindings file. Added in Delphi XE2.
|
||||
# Uncomment this if you are not using LiveBindings Designer.
|
||||
#*.vlb
|
||||
#
|
||||
# Deployment Manager configuration file for your project. Added in Delphi XE2.
|
||||
# Uncomment this if it is not mobile development and you do not use remote debug feature.
|
||||
#*.deployproj
|
||||
#
|
||||
# C++ object files produced when C/C++ Output file generation is configured.
|
||||
# Uncomment this if you are not using external objects (zlib library for example).
|
||||
#*.obj
|
||||
#
|
||||
|
||||
# Delphi compiler-generated binaries (safe to delete)
|
||||
*.exe
|
||||
*.dll
|
||||
*.bpl
|
||||
*.bpi
|
||||
*.dcp
|
||||
*.so
|
||||
*.apk
|
||||
*.drc
|
||||
*.map
|
||||
*.dres
|
||||
*.rsm
|
||||
*.tds
|
||||
*.dcu
|
||||
*.lib
|
||||
*.a
|
||||
*.o
|
||||
*.ocx
|
||||
|
||||
# Delphi autogenerated files (duplicated info)
|
||||
*.cfg
|
||||
*.hpp
|
||||
*Resource.rc
|
||||
|
||||
# Delphi local files (user-specific info)
|
||||
*.local
|
||||
*.identcache
|
||||
*.projdata
|
||||
*.tvsconfig
|
||||
*.dsk
|
||||
|
||||
# Delphi history and backups
|
||||
__history/
|
||||
__recovery/
|
||||
*.~*
|
||||
|
||||
# Castalia statistics file (since XE7 Castalia is distributed with Delphi)
|
||||
*.stat
|
||||
|
||||
# Ignore Build outputs
|
||||
Build
|
||||
Win32
|
||||
Win64
|
||||
48
Delphi/GildedRose.groupproj
Normal file
48
Delphi/GildedRose.groupproj
Normal file
@ -0,0 +1,48 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{3E0B3749-4258-486E-A44B-05088E7E42D6}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Projects Include="TextTestFixture.dproj">
|
||||
<Dependencies/>
|
||||
</Projects>
|
||||
<Projects Include="UnitTests.dproj">
|
||||
<Dependencies/>
|
||||
</Projects>
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>Default.Personality.12</Borland.Personality>
|
||||
<Borland.ProjectType/>
|
||||
<BorlandProject>
|
||||
<Default.Personality/>
|
||||
</BorlandProject>
|
||||
</ProjectExtensions>
|
||||
<Target Name="TextTestFixture">
|
||||
<MSBuild Projects="TextTestFixture.dproj"/>
|
||||
</Target>
|
||||
<Target Name="TextTestFixture:Clean">
|
||||
<MSBuild Projects="TextTestFixture.dproj" Targets="Clean"/>
|
||||
</Target>
|
||||
<Target Name="TextTestFixture:Make">
|
||||
<MSBuild Projects="TextTestFixture.dproj" Targets="Make"/>
|
||||
</Target>
|
||||
<Target Name="UnitTests">
|
||||
<MSBuild Projects="UnitTests.dproj"/>
|
||||
</Target>
|
||||
<Target Name="UnitTests:Clean">
|
||||
<MSBuild Projects="UnitTests.dproj" Targets="Clean"/>
|
||||
</Target>
|
||||
<Target Name="UnitTests:Make">
|
||||
<MSBuild Projects="UnitTests.dproj" Targets="Make"/>
|
||||
</Target>
|
||||
<Target Name="Build">
|
||||
<CallTarget Targets="TextTestFixture;UnitTests"/>
|
||||
</Target>
|
||||
<Target Name="Clean">
|
||||
<CallTarget Targets="TextTestFixture:Clean;UnitTests:Clean"/>
|
||||
</Target>
|
||||
<Target Name="Make">
|
||||
<CallTarget Targets="TextTestFixture:Make;UnitTests:Make"/>
|
||||
</Target>
|
||||
<Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
|
||||
</Project>
|
||||
106
Delphi/GildedRose.pas
Normal file
106
Delphi/GildedRose.pas
Normal file
@ -0,0 +1,106 @@
|
||||
unit GildedRose;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Item,
|
||||
System.Generics.Collections;
|
||||
|
||||
type
|
||||
TGildedRose = class(TObject)
|
||||
private
|
||||
FItems: TObjectList<TItem>;
|
||||
public
|
||||
constructor Create(const AItems: TObjectList<TItem>);
|
||||
procedure UpdateQuality;
|
||||
property Items: TObjectList<TItem> read FItems;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TGildedRose }
|
||||
|
||||
constructor TGildedRose.Create(const AItems: TObjectList<TItem>);
|
||||
begin
|
||||
inherited Create;
|
||||
FItems := AItems;
|
||||
end;
|
||||
|
||||
procedure TGildedRose.UpdateQuality;
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
for I := 0 to Items.Count - 1 do
|
||||
begin
|
||||
if (Items[I].Name <> 'Aged Brie') and (Items[I].Name <> 'Backstage passes to a TAFKAL80ETC concert') then
|
||||
begin
|
||||
if Items[I].Quality > 0 then
|
||||
begin
|
||||
if Items[I].Name <> 'Sulfuras, Hand of Ragnaros' then
|
||||
begin
|
||||
Items[I].Quality := Items[I].Quality - 1;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if Items[I].Quality < 50 then
|
||||
begin
|
||||
Items[I].Quality := Items[I].Quality + 1;
|
||||
if Items[I].Name = 'Backstage passes to a TAFKAL80ETC concert' then
|
||||
begin
|
||||
if Items[I].SellIn < 11 then
|
||||
begin
|
||||
if Items[I].Quality < 50 then
|
||||
begin
|
||||
Items[I].Quality := Items[I].Quality + 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
if Items[I].SellIn < 6 then
|
||||
begin
|
||||
if Items[I].Quality < 50 then
|
||||
begin
|
||||
Items[I].Quality := Items[I].Quality + 1;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if Items[I].Name <> 'Sulfuras, Hand of Ragnaros' then
|
||||
begin
|
||||
Items[I].SellIn := Items[I].SellIn - 1;
|
||||
end;
|
||||
|
||||
if Items[I].SellIn < 0 then
|
||||
begin
|
||||
if Items[I].Name <> 'Aged Brie' then
|
||||
begin
|
||||
if Items[I].Name <> 'Backstage passes to a TAFKAL80ETC concert' then
|
||||
begin
|
||||
if Items[I].Quality > 0 then
|
||||
begin
|
||||
if Items[I].Name <> 'Sulfuras, Hand of Ragnaros' then
|
||||
begin
|
||||
Items[I].Quality := Items[I].Quality - 1;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Items[I].Quality := Items[I].Quality - Items[I].Quality;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if Items[I].Quality < 50 then
|
||||
begin
|
||||
Items[I].Quality := Items[I].Quality + 1;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
36
Delphi/GildedRoseTests.pas
Normal file
36
Delphi/GildedRoseTests.pas
Normal file
@ -0,0 +1,36 @@
|
||||
unit GildedRoseTests;
|
||||
|
||||
interface
|
||||
uses
|
||||
DUnitX.TestFramework,
|
||||
GildedRose,
|
||||
Item,
|
||||
System.Generics.Collections;
|
||||
|
||||
type
|
||||
[TestFixture]
|
||||
TGildedRoseTests = class(TObject)
|
||||
public
|
||||
[Test]
|
||||
procedure UpdateQuality_Never_ChangesTheItemName;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
procedure TGildedRoseTests.UpdateQuality_Never_ChangesTheItemName;
|
||||
var
|
||||
LItems: TObjectList<TItem>;
|
||||
LGildedRose: TGildedRose;
|
||||
begin
|
||||
LItems := TObjectList<TItem>.Create;
|
||||
LItems.Add(TItem.Create('foo', 0, 0));
|
||||
LGildedRose := TGildedRose.Create(LItems);
|
||||
|
||||
LGildedRose.UpdateQuality;
|
||||
|
||||
Assert.AreEqual('fixme', LGildedRose.Items[0].Name);
|
||||
end;
|
||||
|
||||
initialization
|
||||
TDUnitX.RegisterTestFixture(TGildedRoseTests);
|
||||
end.
|
||||
39
Delphi/Item.pas
Normal file
39
Delphi/Item.pas
Normal file
@ -0,0 +1,39 @@
|
||||
unit Item;
|
||||
|
||||
interface
|
||||
|
||||
type
|
||||
TItem = class(TObject)
|
||||
private
|
||||
FName: string;
|
||||
FSellIn: Integer;
|
||||
FQuality: Integer;
|
||||
public
|
||||
constructor Create(const AName: string; const ASellIn, AQuality: Integer);
|
||||
function ToString: string; override;
|
||||
property Name: string read FName write FName;
|
||||
property SellIn: Integer read FSellIn write FSellIn;
|
||||
property Quality: Integer read FQuality write FQuality;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
System.SysUtils;
|
||||
|
||||
{ TItem }
|
||||
|
||||
constructor TItem.Create(const AName: string; const ASellIn, AQuality: Integer);
|
||||
begin
|
||||
inherited Create;
|
||||
FName := AName;
|
||||
FSellIn := ASellIn;
|
||||
FQuality := AQuality;
|
||||
end;
|
||||
|
||||
function TItem.ToString: string;
|
||||
begin
|
||||
Result := Format('%s, %d, %d', [Name, SellIn, Quality]);
|
||||
end;
|
||||
|
||||
end.
|
||||
13
Delphi/README.md
Normal file
13
Delphi/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Delphi port of the Gilded-Rose Kata
|
||||
This is a Delphi port of the *Gilded-Rose-Kata*.
|
||||
|
||||
## Version Compatibility
|
||||
The project files are written in Delphi 10.3.3 therefore require 10.3 or later.
|
||||
That said, the actual code should be compatible back to Delphi 2010 as the unit
|
||||
tests are written in [DUnitX](https://github.com/VSoftTechnologies/DUnitX) which
|
||||
requires Delphi 2010 or later.
|
||||
|
||||
## Building and Running
|
||||
* Open the project group `GildedRose.groupproj`.
|
||||
* Build and run the `TextTestFixture.exe` for the text output tests.
|
||||
* Build and run the `UnitTests.exe` project to execute the unit tests.
|
||||
57
Delphi/TextTestFixture.dpr
Normal file
57
Delphi/TextTestFixture.dpr
Normal file
@ -0,0 +1,57 @@
|
||||
program TextTestFixture;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
{$R *.res}
|
||||
|
||||
uses
|
||||
System.SysUtils,
|
||||
System.Generics.Collections,
|
||||
GildedRose in 'GildedRose.pas',
|
||||
Item in 'Item.pas';
|
||||
|
||||
var
|
||||
Days, ErrorCode, I, J: Integer;
|
||||
Items: TObjectList<TItem>;
|
||||
App: TGildedRose;
|
||||
|
||||
begin
|
||||
try
|
||||
Writeln('OMGHAI!');
|
||||
|
||||
Items := TObjectList<TItem>.Create;
|
||||
Items.Add(TItem.Create('+5 Dexterity Vest', 10, 20));
|
||||
Items.Add(TItem.Create('Aged Brie', 2, 0));
|
||||
Items.Add(TItem.Create('Elixir of the Mongoose', 5, 7));
|
||||
Items.Add(TItem.Create('Sulfuras, Hand of Ragnaros', 0, 80));
|
||||
Items.Add(TItem.Create('Sulfuras, Hand of Ragnaros', -1, 80));
|
||||
Items.Add(TItem.Create('Backstage passes to a TAFKAL80ETC concert', 15, 20));
|
||||
Items.Add(TItem.Create('Backstage passes to a TAFKAL80ETC concert', 10, 49));
|
||||
Items.Add(TItem.Create('Backstage passes to a TAFKAL80ETC concert', 5, 49));
|
||||
// this conjured item does not work properly yet
|
||||
Items.Add(TItem.Create('Conjured Mana Cake', 3, 6));
|
||||
|
||||
App := TGildedRose.Create(Items);
|
||||
|
||||
Days := 2;
|
||||
if ParamCount > 0 then
|
||||
begin
|
||||
Val(ParamStr(1), Days, ErrorCode);
|
||||
Inc(Days);
|
||||
end;
|
||||
|
||||
for I := 0 to Days - 1 do
|
||||
begin
|
||||
Writeln(Format('-------- day %d --------', [I]));
|
||||
Writeln('name, sellIn, quality');
|
||||
for J := 0 to Items.Count - 1 do
|
||||
Writeln(Items[J].ToString);
|
||||
Writeln;
|
||||
|
||||
App.UpdateQuality;
|
||||
end;
|
||||
except
|
||||
on E: Exception do
|
||||
Writeln(E.ClassName, ': ', E.Message);
|
||||
end;
|
||||
end.
|
||||
1019
Delphi/TextTestFixture.dproj
Normal file
1019
Delphi/TextTestFixture.dproj
Normal file
File diff suppressed because it is too large
Load Diff
59
Delphi/UnitTests.dpr
Normal file
59
Delphi/UnitTests.dpr
Normal file
@ -0,0 +1,59 @@
|
||||
program UnitTests;
|
||||
|
||||
{$IFNDEF TESTINSIGHT}
|
||||
{$APPTYPE CONSOLE}
|
||||
{$ENDIF}{$STRONGLINKTYPES ON}
|
||||
uses
|
||||
System.SysUtils,
|
||||
{$IFDEF TESTINSIGHT}
|
||||
TestInsight.DUnitX,
|
||||
{$ENDIF }
|
||||
DUnitX.Loggers.Console,
|
||||
DUnitX.Loggers.Xml.NUnit,
|
||||
DUnitX.TestFramework,
|
||||
GildedRoseTests in 'GildedRoseTests.pas';
|
||||
|
||||
var
|
||||
runner : ITestRunner;
|
||||
results : IRunResults;
|
||||
logger : ITestLogger;
|
||||
nunitLogger : ITestLogger;
|
||||
begin
|
||||
{$IFDEF TESTINSIGHT}
|
||||
TestInsight.DUnitX.RunRegisteredTests;
|
||||
exit;
|
||||
{$ENDIF}
|
||||
try
|
||||
//Check command line options, will exit if invalid
|
||||
TDUnitX.CheckCommandLine;
|
||||
//Create the test runner
|
||||
runner := TDUnitX.CreateRunner;
|
||||
//Tell the runner to use RTTI to find Fixtures
|
||||
runner.UseRTTI := True;
|
||||
//tell the runner how we will log things
|
||||
//Log to the console window
|
||||
logger := TDUnitXConsoleLogger.Create(true);
|
||||
runner.AddLogger(logger);
|
||||
//Generate an NUnit compatible XML File
|
||||
nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile);
|
||||
runner.AddLogger(nunitLogger);
|
||||
runner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests;
|
||||
|
||||
//Run tests
|
||||
results := runner.Execute;
|
||||
if not results.AllPassed then
|
||||
System.ExitCode := EXIT_ERRORS;
|
||||
|
||||
{$IFNDEF CI}
|
||||
//We don't want this happening when running under CI.
|
||||
if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then
|
||||
begin
|
||||
System.Write('Done.. press <Enter> key to quit.');
|
||||
System.Readln;
|
||||
end;
|
||||
{$ENDIF}
|
||||
except
|
||||
on E: Exception do
|
||||
System.Writeln(E.ClassName, ': ', E.Message);
|
||||
end;
|
||||
end.
|
||||
937
Delphi/UnitTests.dproj
Normal file
937
Delphi/UnitTests.dproj
Normal file
@ -0,0 +1,937 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{9379A28B-85A1-455B-BE8B-BDE5DD446BDF}</ProjectGuid>
|
||||
<ProjectVersion>18.8</ProjectVersion>
|
||||
<FrameworkType>None</FrameworkType>
|
||||
<MainSource>UnitTests.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
<TargetedPlatforms>1</TargetedPlatforms>
|
||||
<AppType>Console</AppType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='iOSDevice32' and '$(Base)'=='true') or '$(Base_iOSDevice32)'!=''">
|
||||
<Base_iOSDevice32>true</Base_iOSDevice32>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='iOSDevice64' and '$(Base)'=='true') or '$(Base_iOSDevice64)'!=''">
|
||||
<Base_iOSDevice64>true</Base_iOSDevice64>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='iOSSimulator' and '$(Base)'=='true') or '$(Base_iOSSimulator)'!=''">
|
||||
<Base_iOSSimulator>true</Base_iOSSimulator>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='OSX32' and '$(Base)'=='true') or '$(Base_OSX32)'!=''">
|
||||
<Base_OSX32>true</Base_OSX32>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='OSX64' and '$(Base)'=='true') or '$(Base_OSX64)'!=''">
|
||||
<Base_OSX64>true</Base_OSX64>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
|
||||
<Base_Win32>true</Base_Win32>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
|
||||
<Base_Win64>true</Base_Win64>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
|
||||
<Cfg_1_Win32>true</Cfg_1_Win32>
|
||||
<CfgParent>Cfg_1</CfgParent>
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
|
||||
<Cfg_2>true</Cfg_2>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base)'!=''">
|
||||
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
|
||||
<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
|
||||
<DCC_E>false</DCC_E>
|
||||
<DCC_N>false</DCC_N>
|
||||
<DCC_S>false</DCC_S>
|
||||
<DCC_F>false</DCC_F>
|
||||
<DCC_K>false</DCC_K>
|
||||
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
|
||||
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
|
||||
<Icns_MainIcns>$(BDS)\bin\delphi_PROJECTICNS.icns</Icns_MainIcns>
|
||||
<DCC_UnitSearchPath>$(DUnitX);$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||
<SanitizedProjectName>UnitTests</SanitizedProjectName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_iOSDevice32)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;FmxTeeUI;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;FMXTee;soaprtl;DbxCommonDriver;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_iOSDevice64)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;FmxTeeUI;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;FMXTee;soaprtl;DbxCommonDriver;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_iOSSimulator)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;FmxTeeUI;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;FMXTee;soaprtl;DbxCommonDriver;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_OSX32)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;FireDACMSSQLDriver;bindcompfmx;DBXOracleDriver;inetdb;FmxTeeUI;fmx;FireDACIBDriver;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;FireDACPgDriver;FireDACASADriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;FireDACDSDriver;rtl;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;bindcomp;DBXInformixDriver;IndyIPClient;dbxcds;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_OSX64)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;FireDACMSSQLDriver;bindcompfmx;DBXOracleDriver;inetdb;FmxTeeUI;fmx;FireDACIBDriver;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;FireDACPgDriver;FireDACASADriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;FireDACDSDriver;rtl;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;bindcomp;DBXInformixDriver;IndyIPClient;dbxcds;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;fmxase;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;tethering;svnui;DataSnapFireDAC;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;DBXOracleDriver;inetdb;FmxTeeUI;emsedge;fmx;FireDACIBDriver;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;vcl;IndyIPServer;DBXSybaseASEDriver;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;emsserverresource;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
||||
<BT_BuildType>Debug</BT_BuildType>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;fmxase;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;tethering;DataSnapFireDAC;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;DBXOracleDriver;inetdb;FmxTeeUI;emsedge;fmx;FireDACIBDriver;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;vcl;IndyIPServer;DBXSybaseASEDriver;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;emsserverresource;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
|
||||
<DCC_DebugDCUs>true</DCC_DebugDCUs>
|
||||
<DCC_Optimize>false</DCC_Optimize>
|
||||
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
|
||||
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
|
||||
<DCC_RemoteDebug>true</DCC_RemoteDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
||||
<DCC_RemoteDebug>false</DCC_RemoteDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
||||
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
|
||||
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
||||
<DCC_DebugInformation>0</DCC_DebugInformation>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<DelphiCompile Include="$(MainSource)">
|
||||
<MainSource>MainSource</MainSource>
|
||||
</DelphiCompile>
|
||||
<DCCReference Include="GildedRoseTests.pas"/>
|
||||
<BuildConfiguration Include="Release">
|
||||
<Key>Cfg_2</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Debug">
|
||||
<Key>Cfg_1</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
||||
<Borland.ProjectType>Console</Borland.ProjectType>
|
||||
<BorlandProject>
|
||||
<Delphi.Personality>
|
||||
<Source>
|
||||
<Source Name="MainSource">UnitTests.dpr</Source>
|
||||
</Source>
|
||||
</Delphi.Personality>
|
||||
<Deployment Version="3">
|
||||
<DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule">
|
||||
<Platform Name="OSX32">
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libcgunwind.1.0.dylib" Class="DependencyModule">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libpcre.dylib" Class="DependencyModule">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployFile LocalName="Win32\Debug\UnitTests.exe" Configuration="Debug" Class="ProjectOutput">
|
||||
<Platform Name="Win32">
|
||||
<RemoteName>UnitTests.exe</RemoteName>
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployClass Name="AdditionalDebugSymbols">
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidClassesDexFile">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>classes</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>classes</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidFileProvider">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\xml</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\xml</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidGDBServer">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidLibnativeArmeabiFile">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\armeabi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidLibnativeArmeabiv7aFile">
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidLibnativeMipsFile">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\mips</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\mips</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidServiceOutput">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\arm64-v8a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidServiceOutput_Android32">
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidSplashImageDef">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidSplashStyles">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidSplashStylesV21">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\values-v21</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\values-v21</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_Colors">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_DefaultAppIcon">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon144">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon36">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-ldpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-ldpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon48">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-mdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-mdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon72">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-hdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-hdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon96">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_NotificationIcon24">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-mdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-mdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_NotificationIcon36">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-hdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-hdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_NotificationIcon48">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_NotificationIcon72">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_NotificationIcon96">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage426">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-small</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-small</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage470">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-normal</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-normal</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage640">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-large</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-large</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage960">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xlarge</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xlarge</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_Strings">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DebugSymbols">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DependencyFramework">
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.framework</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.framework</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DependencyModule">
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
<Extensions>.dll;.bpl</Extensions>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Required="true" Name="DependencyPackage">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
<Extensions>.bpl</Extensions>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="File">
|
||||
<Platform Name="Android">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch1024x768">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch1536x2048">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch1668">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch1668x2388">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch2048x1536">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch2048x2732">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch2224">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch2388x1668">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch2732x2048">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch768x1024">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch1125">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch1136x640">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch1242">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch1242x2688">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch1334">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch1792">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch2208">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch2436">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch2688x1242">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch320">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch640">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch640x1136">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch750">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch828">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectAndroidManifest">
|
||||
<Platform Name="Android">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceDebug">
|
||||
<Platform Name="iOSDevice32">
|
||||
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
|
||||
<DeployClass Name="ProjectiOSEntitlements"/>
|
||||
<DeployClass Name="ProjectiOSInfoPList"/>
|
||||
<DeployClass Name="ProjectiOSResource">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXDebug"/>
|
||||
<DeployClass Name="ProjectOSXEntitlements"/>
|
||||
<DeployClass Name="ProjectOSXInfoPList"/>
|
||||
<DeployClass Name="ProjectOSXResource">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\Resources</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<RemoteDir>Contents\Resources</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Required="true" Name="ProjectOutput">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\arm64-v8a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Linux64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOutput_Android32">
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectUWPManifest">
|
||||
<Platform Name="Win32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="UWP_DelphiLogo150">
|
||||
<Platform Name="Win32">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="UWP_DelphiLogo44">
|
||||
<Platform Name="Win32">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
|
||||
</Deployment>
|
||||
<Platforms>
|
||||
<Platform value="iOSDevice32">False</Platform>
|
||||
<Platform value="iOSDevice64">False</Platform>
|
||||
<Platform value="iOSSimulator">False</Platform>
|
||||
<Platform value="OSX32">False</Platform>
|
||||
<Platform value="OSX64">False</Platform>
|
||||
<Platform value="Win32">True</Platform>
|
||||
<Platform value="Win64">False</Platform>
|
||||
</Platforms>
|
||||
</BorlandProject>
|
||||
<ProjectFileVersion>12</ProjectFileVersion>
|
||||
</ProjectExtensions>
|
||||
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
|
||||
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
|
||||
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
|
||||
</Project>
|
||||
37
GildedRoseRequirements.md
Normal file
37
GildedRoseRequirements.md
Normal file
@ -0,0 +1,37 @@
|
||||
# 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 `SellIn` value which denotes the number of days we have to sell the `items`
|
||||
- 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 its `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.
|
||||
31
GildedRoseRequirements_de.md
Normal file
31
GildedRoseRequirements_de.md
Normal file
@ -0,0 +1,31 @@
|
||||
# Anforderungsspezifikation für vergoldete Rose (Gilded Rose)
|
||||
|
||||
Hallo und willkommen im Team **Gilded Rose**. Wie Du sicher weißt, sind wir ein kleiner Gasthof in bester Lage in einer bekannten Stadt, der von einem freundlichen Gastwirt namens Allison geführt wird.
|
||||
Wir kaufen und verkaufen nur die besten Produkte.
|
||||
Leider verschlechtert sich die Qualität unserer Waren ständig, da sie sich ihrem Mindesthaltbarkeitsdatum nähern.
|
||||
Wir haben ein System eingerichtet, um den Bestand automatisch aktualisieren zu können.
|
||||
Es wurde von Leeroy entwickelt, ein vernünftiger Typ, der zu neuen Abenteuern aufgebrochen ist.
|
||||
Damit wir mit dem Verkauf eines neuen Produkttyps beginnen können, ist es nun Deine Aufgabe, unserem System eine neue Funktion hinzuzufügen.
|
||||
|
||||
Zunächst eine Einführung in unser bestehendes System:
|
||||
* Alle Artikel (`Item`) haben einen `SellIn`-Wert, der die Anzahl der Tage angibt, die uns verbleiben, um den Artikel zu verkaufen
|
||||
* Alle Artikel haben einen `Quality`-Wert (Qualität), der angibt, wie wertvoll der Artikel ist
|
||||
* Am Tagesende senkt unser System für jeden Artikel beide Werte
|
||||
|
||||
Ziemlich einfach, oder? Nicht ganz, denn jetzt wird es interessant:
|
||||
|
||||
* Sobald das "Mindesthaltbarkeitsdatum" überschritten wurde, nimmt die „Qualität“ doppelt so schnell ab
|
||||
* Die "Qualität" eines Artikels ist nie negativ
|
||||
* "Alter Brie" (`Aged Brie`) nimmt an Qualität zu, je älter er wird
|
||||
* Die "Qualität" eines Artikels ist nie höher als 50
|
||||
* Der legendäre Artikel "Sulfuras" ändert weder sein "Verkaufsdatum", noch verschlechtert sich seine "Qualität"
|
||||
* "Backstage-Pässe" (`backstage passes`) werden - wie `Aged Brie` - hochwertiger, solange das "Verkaufsdatum" noch nicht erreicht wurde.
|
||||
Bei 10 Tagen oder weniger erhöht sich die Qualität um 2, bei 5 Tagen oder weniger um 3, nach dem "Konzert" sinkt sie aber auf 0.
|
||||
|
||||
Kürzlich haben wir einen Lieferanten für "beschworene" (`conjured`) Artikel unter Vertrag genommen. Dies erfordert ein Update unseres Systems:
|
||||
* "Beschworene" Artikel verlieren doppelt so schnell an Qualität wie normale Artikel
|
||||
|
||||
Solange alles einwandfrei funktioniert, kannst Du beliebige Änderungen an der Methode `updateQuality` vornehmen und so viel Code hinzufügen, wie Du möchtest. Aber Vorsicht: Die `Item`-Klasse oder ihre Eigenschaften darfst Du in keiner Weise ändern, denn diese Klasse gehört dem Kobold in der Ecke, der sofort wütend wird und Dich sofort töten würde, denn er glaubt nicht an die Kultur von gemeinsamem Code (`shared code`).
|
||||
(Wenn Du möchtest, kannst Du die `updateQuality`-Methode und die `Item`-Eigenschaft statisch machen, das regeln wir dann.)
|
||||
|
||||
Sicherheitshalber noch ein Hinweis: Die Qualität eines Artikels kann nie höher als 50 sein, aber `Sulfuras` ist ein legendärer Artikel und als solcher beträgt seine Qualität 80 und ändert sich auch nie.
|
||||
45
GildedRoseRequirements_es.md
Normal file
45
GildedRoseRequirements_es.md
Normal file
@ -0,0 +1,45 @@
|
||||
# Especificaciones de la Rosa Dorada (Gilded Rose)
|
||||
|
||||
Bienvenido al equipo de **Gilded Rose**.
|
||||
Como quizá sabes, somos una pequeña posada ubicada estratégicamente en una prestigiosa ciudad, atendida por la amable **Allison**.
|
||||
También compramos y vendemos mercadería de alta calidad.
|
||||
Por desgracia, nuestra mercadería va bajando de calidad a medida que se aproxima la fecha de venta.
|
||||
|
||||
Tenemos un sistema instalado que actualiza automáticamente el `inventario`.
|
||||
Este sistema fue desarrollado por un muchacho con poco sentido común llamado Leeroy, que ahora se dedica a nuevas aventuras.
|
||||
Tu tarea es agregar una nueva característica al sistema para que podamos comenzar a vender una nueva categoría de items.
|
||||
|
||||
## Descripción preliminar
|
||||
|
||||
Pero primero, vamos a introducir el sistema:
|
||||
|
||||
* Todos los artículos (`Item`) tienen una propiedad `sellIn` que denota el número de días que tenemos para venderlo
|
||||
* Todos los artículos tienen una propiedad `quality` que denota cúan valioso es el artículo
|
||||
* Al final de cada día, nuestro sistema decrementa ambos valores para cada artículo mediante el método `updateQuality`
|
||||
|
||||
Bastante simple, ¿no? Bueno, ahora es donde se pone interesante:
|
||||
|
||||
* Una vez que ha pasado la fecha recomendada de venta, la `calidad` se degrada al doble de velocidad
|
||||
* La `calidad` de un artículo nunca es negativa
|
||||
* El "Queso Brie envejecido" (`Aged brie`) incrementa su `calidad` a medida que se pone viejo
|
||||
* Su `calidad` aumenta en `1` unidad cada día
|
||||
* luego de la `fecha de venta` su `calidad` aumenta `2` unidades por día
|
||||
* La `calidad` de un artículo nunca es mayor a `50`
|
||||
* El artículo "Sulfuras" (`Sulfuras`), siendo un artículo legendario, no modifica su `fecha de venta` ni se degrada en `calidad`
|
||||
* Una "Entrada al Backstage", como el queso brie, incrementa su `calidad` a medida que la `fecha de venta` se aproxima
|
||||
* si faltan 10 días o menos para el concierto, la `calidad` se incrementa en `2` unidades
|
||||
* si faltan 5 días o menos, la `calidad` se incrementa en `3` unidades
|
||||
* luego de la `fecha de venta` la `calidad` cae a `0`
|
||||
|
||||
## El requerimiento
|
||||
|
||||
Hace poco contratamos a un proveedor de artículos *conjurados mágicamente*.
|
||||
Esto requiere una actualización del sistema:
|
||||
|
||||
* Los artículos `conjurados` degradan su `calidad` al doble de velocidad que los normales
|
||||
|
||||
Siéntete libre de realizar cualquier cambio al mensaje `updateQuality` y agregar el código que sea necesario, mientras que todo siga funcionando correctamente. Sin embargo, **no alteres el objeto `Item` ni sus propiedades** ya que pertenecen al goblin que está en ese rincón, que en un ataque de ira te va a liquidar de un golpe porque no cree en la cultura de código compartido.
|
||||
|
||||
## Notas finales
|
||||
|
||||
Para aclarar: un artículo nunca puede tener una `calidad` superior a `50`, sin embargo las Sulfuras siendo un artículo legendario posee una calidad inmutable de `80`.
|
||||
36
GildedRoseRequirements_eu.md
Normal file
36
GildedRoseRequirements_eu.md
Normal file
@ -0,0 +1,36 @@
|
||||
# Urrezko Arrosaren zehaztapenak (Gilded Rose)
|
||||
|
||||
Ongi etorri **Gilded Rose**-eko taldera.
|
||||
Jakingo duzunez, hiri ospetsu batean estrategikoki kokatutako ostatu txiki bat gara, Allison atseginak zuzendua. Kalitate oneneko salgaiak ere erosten eta saltzen ditugu. Zoritxarrez, gure salgaiak kalitatez jaisten doaz salmenta-data hurbildu ahala.
|
||||
|
||||
Inbentarioa automatikoki eguneratzen duen sistema bat dugu instalaturik. Gaur egun abentura berrietan dabilen Leeroy izeneko mutiko zentzugabe batek garatu zuen sistema hau. Zure zeregina sistemari ezaugarri berri bat gehitzea da, artikulu kategoria berri bat saltzen has gaitezen.
|
||||
|
||||
## Hasierako deskribapena
|
||||
|
||||
Baina lehenik, sistema azalduko dugu:
|
||||
|
||||
* Artikulu guztiek (`Item`) `sellIn` izeneko propietate bat dute berau saltzeko ditugun egunen kopurua adierazten duena.
|
||||
* Artikulu guztiek `quality` izeneko propietate bat dute artikulu hori zein baliotsua den adierazten duena.
|
||||
* Egunaren amaieran, gure sistemak artikulu bakoitzerako bi balio horiek gutxitzen ditu `updateQuality` metodoaren bitartez.
|
||||
|
||||
Nahiko sinplea, ezta? Beno, orain da interesgarri jartzen denean:
|
||||
|
||||
* Behin gomendatutako salmenta-data igarota, kalitatea (`quality`) bi aldiz azkarrago degradatzen da.
|
||||
* Artikulu baten kalitatea (`quality`) ez da inoiz negatiboa.
|
||||
* “Aged brie”-ren kalitatea (`quality`) hobetu egiten da zahartu ahala unitate `1` gehituz egun bakoitzeko.
|
||||
* Artikulu baten kalitatea (`quality`) ezin da inoiz `50` baino handiagoa izan.
|
||||
* "Sulfuras" artikuluak, artikulu legendarioa izanik, ez du salmenta-data aldatzen eta bere kalitatea ez da degradatzen.
|
||||
* "Backstage Passes"-ak, "Aged brie”-a bezala, kalitatean (`quality`) hobetzen doaz salmenta-data (`sellIn`) hurbildu ahala:
|
||||
* Salmenta-datarako (`sellIn`) `10` egun edo gutxiago falta badira, kalitatea (`quality`) `2` unitatetan haundituko da.
|
||||
* Salmenta-datarako (`sellIn`) `5` egun edo gutxiago falta badira, kalitatea (`quality`) `3` unitatetan haundituko da.
|
||||
* Salmenta-data (`sellIn`) pasa ondoren, kalitatea (`quality`) `0`ra pasako da.
|
||||
|
||||
Duela gutxi, konjuratutako artikulu hornitzaile bat kontratatu genuen. Horretarako, sistema eguneratu behar da:
|
||||
|
||||
* Konjuratutako (`conjured`) artikuluek normalek baino `2` aldiz azkarrago degradatzen dute kalitatea (`quality`).
|
||||
|
||||
Lasai alda dezakez `updateQuality` metodoa beharrezkoa ikusten duzu kodea gehitzeko, beti ere, denak behar bezela funtzionatzen jarraitzen duen bitartean. Baina ezin duzu ordea `Item` objektua ezta bere propietaterik aldatu, txokoan dagoen goblinarenak bait dira eta haserre-krisi batean erasotu egin zaitzake ez bait du kode jabetza partekatuan sinisten.
|
||||
|
||||
## Azken oharrak
|
||||
|
||||
Argitzearren, artikulu batek ezin du inoiz `50` baino kalitate (`quality`) handiagoa izan, "Sulfuras" ordea, artikulu legendario bat izanik, `80`ko kalitate aldaezina dauka.
|
||||
41
GildedRoseRequirements_fr.md
Normal file
41
GildedRoseRequirements_fr.md
Normal file
@ -0,0 +1,41 @@
|
||||
# Spécification de la Rose dorée (Gilded Rose)
|
||||
|
||||
Bonjour et bienvenue dans l'équipe de la Rose dorée.
|
||||
|
||||
Comme vous le savez, notre petite taverne située à proximité d'une cité importante est dirigée par l'aubergiste amicale Allison.
|
||||
|
||||
Nous achetons et vendons uniquement les meilleurs produits.
|
||||
Malheureusement, la qualité de nos marchandises se dégrade constamment à l'approche de leur date de péremption.
|
||||
|
||||
Un système a été mis en place pour mettre à jour notre inventaire.
|
||||
Il a été développé par Leeroy, une personne pleine de bon sens qui est partie pour de nouvelles aventures.
|
||||
|
||||
Votre mission est d'ajouter une nouvelle fonctionnalité à notre système pour que nous puissions commencer à vendre un nouveau type de produits.
|
||||
|
||||
Mais d'abord, laissez-moi vous présenter notre système :
|
||||
|
||||
- Tous les éléments ont une valeur `sellIn` qui désigne le nombre de jours restant pour vendre l'article.
|
||||
- Tous les articles ont une valeur `quality` qui dénote combien l'article est précieux.
|
||||
- À la fin de chaque journée, notre système diminue ces deux valeurs pour chaque produit.
|
||||
|
||||
Plutôt simple, non ?
|
||||
|
||||
Attendez, ça devient intéressant :
|
||||
|
||||
- Une fois que la date de péremption est passée, la qualité se dégrade deux fois plus rapidement.
|
||||
- La qualité (`quality`) d'un produit ne peut jamais être négative.
|
||||
- "Aged Brie" augmente sa qualité (`quality`) plus le temps passe.
|
||||
- La qualité d'un produit n'est jamais de plus de 50.
|
||||
- "Sulfuras", étant un objet légendaire, n'a pas de date de péremption et ne perd jamais en qualité (`quality`)
|
||||
- "Backstage passes", comme le "Aged Brie", augmente sa qualité (`quality`) plus le temps passe (`sellIn`) ; La qualité augmente de 2 quand il reste 10 jours ou moins et de 3 quand il reste 5 jours ou moins, mais la qualité tombe à 0 après le concert.
|
||||
|
||||
Nous avons récemment signé un partenariat avec un fournisseur de produit invoqué ("Conjured").
|
||||
Cela nécessite une mise à jour de notre système :
|
||||
|
||||
- les éléments "Conjured" voient leur qualité se dégrader de deux fois plus vite que les objets normaux.
|
||||
|
||||
Vous pouvez faire les changements que vous voulez à la méthode `updateQuality` et ajouter autant de code que vous voulez, tant que tout fonctionne correctement.
|
||||
Cependant, nous devons vous prévenir, vous ne devez en aucun cas modifier la classe `Item` ou ses propriétés car cette classe appartient au gobelin à l'étage qui entrerait dans une rage instantanée et vous tuerait sans délai : il ne croit pas au partage du code.
|
||||
(Vous pouvez rendre la méthode `updateQuality` statique, ainsi que des propriétés dans la classe `Item` si vous voulez, nous vous couvrirons)
|
||||
|
||||
Juste une précision, un produit ne peut jamais voir sa qualité augmenter au-dessus de 50, cependant "Sulfuras" est un objet légendaire et comme tel sa qualité est de 80 et elle ne change jamais.
|
||||
45
GildedRoseRequirements_it.md
Normal file
45
GildedRoseRequirements_it.md
Normal file
@ -0,0 +1,45 @@
|
||||
# Requisiti della rosa dorata (Gilded Rose)
|
||||
|
||||
|
||||
Ciao, benvenuto nel team **Rosa dorata**.
|
||||
Come sapete, siamo una piccola locanda con una posizione privilegiata in una importante città
|
||||
gestita da un amichevole locandiere di nome Allison.
|
||||
Compriamo e vendiamo solo i prodotti migliori.
|
||||
|
||||
Sfortunatamente, la qualità dei nostri prodotti diminuisce costantemente man mano che si avvicinano alla data di scadenza.
|
||||
Disponiamo di un sistema che aggiorna il nostro inventario in automatico.
|
||||
Il sistema è stato sviluppato da un tipo pratico chiamato Leeroy, che è passato a nuove avventure.
|
||||
|
||||
Il tuo compito è aggiungere una nuova funzionalità al nostro sistema in modo che possiamo iniziare a vendere una nuova categoria di articoli.
|
||||
|
||||
## Decrizione del sistema:
|
||||
|
||||
- Tutti i prodotti (`Item`) hanno una proprietà `sellIn` che indica quanti giorni mancano alla data di scadenza.
|
||||
- Tutti i prodotti (`Item`) hanno una proprietà `quality` che denota il valore dell'articolo.
|
||||
- Alla fine di ogni giornata il nostro sistema decrementa entrambe le proprietà per ogni prodotto tramite il metodo `updateQuality`
|
||||
|
||||
Abbastanza semplice, vero? Bene, è da qui che la cosa si fa interessante:
|
||||
|
||||
- Una volta passata la data di scadenza, la proprietà `quality` diminuisce due volte più velocemente
|
||||
- La proprietà `quality` di un prodotto non può essere mai negativa
|
||||
- Il prodotto "Brie invecchiato" (`Aged brie`) aumenta di uno la sua `quality` man mano che invecchia
|
||||
- La `quality` di un prodotto non può mai essere superiore a 50
|
||||
- Il prodotto "Sulfuras" (`Sulfuras`), essendo un oggetto leggendario, non modifica mai ne la proprietà `sellIn` ne degrada la proprietà `quality`
|
||||
- I prodotto "Backstage pass" (`Backstage pass`), come il brie invecchiato (`Aged brie`), aumentano `quality` man mano che il loro valore di `sellIn` si avvicina a 0
|
||||
- La proprietà `quality` aumenta di 2 quando mancano 10 giorni o meno e di 3 quando ci sono 5 giorni o meno ma,
|
||||
- La proprietà `quality` scende a 0 quando il valore di `sellIn` scende a 0.
|
||||
|
||||
## La nuova richiesta:
|
||||
|
||||
Recentemente è stato firmato un contratto con un fornitore di oggetti "oggetti magici" (`conjurados`)
|
||||
Ciò richiede un aggiornamento del nostro sistema:
|
||||
|
||||
- Gli "oggetti magici" (`conjurados`) diminuiscono di `quality` due volte più velocemente rispetto ai prodotti normali.
|
||||
|
||||
Sentiti libero di apportare qualsiasi modifica al metodo "updateQuality" ed aggiungere codice se necessario, purché tutto continui a funzionare correttamente.
|
||||
Tuttavia, **non alterare l'oggetto `Item` o le sue proprietà** poiché appartengono al goblin nell'angolo, che in un impeto di rabbia ti colpirà perché non crede nella cultura della condivisione del codice.
|
||||
|
||||
## Note finali:
|
||||
|
||||
- Un prodotto non può mai avere un aumento di qualità `quality` superiore a 50, tuttavia
|
||||
- il prodotto "Sulfuras" (`Sulfuras`) è un oggetto leggendario e come tale la sua Qualità `quality` è 80 e non si altera mai.
|
||||
33
GildedRoseRequirements_jp.md
Normal file
33
GildedRoseRequirements_jp.md
Normal file
@ -0,0 +1,33 @@
|
||||
# Gilded Rose 要件仕様書
|
||||
こんにちは、チーム・ギルドローズへようこそ。我々はアリソンという気さくな人が経営する、都会の一等地にある小さな宿です。
|
||||
|
||||
また、私たちは最高級の商品のみを仕入れて販売しています。残念なことに、商品は販売期限が近づくにつれ、品質が低下していきます。
|
||||
|
||||
私たちには在庫を更新するシステムがあります。これは、新たな冒険へと旅立ったリーロイという無神経な性格の人物によって開発されました。
|
||||
|
||||
あなたの仕事は、システムに新しい機能を追加して、新しいカテゴリーのアイテムを販売できるようにすることです。
|
||||
|
||||
最初にシステムの紹介をします。
|
||||
|
||||
* すべてのアイテムには、アイテムを販売するための残り日数(販売期限)を示すSellIn値があります。
|
||||
* すべてのアイテムには、そのアイテムの価値を示すQuality値があります。
|
||||
* 毎日の終わりには、私たちのシステムは、両方の項目の値を1小さくします。
|
||||
|
||||
簡単でしょ?ここからが面白いところです。
|
||||
|
||||
* 販売するための残り日数が無くなると、Quality値は2小さくなります。
|
||||
* Quality値は決してマイナスにはなりません。
|
||||
* "Aged Brie"は、日が経つほどQuality値が上がっていきます。
|
||||
* Quality値は50以上にはなりません。
|
||||
* "Sulfuras"は伝説のアイテムなので、販売されたり、Quality値が低下したりすることはありません。
|
||||
* "Backstage passes"は、"Aged Brie"と同様、SellIn値が近づくにつれてQuality値が上昇し、10日以内になると毎日2上がり、5日以内になると毎日3上がりますが、コンサート終了後には0になります。
|
||||
|
||||
最近、"Conjured"アイテムのサプライヤーと契約しました。そのため、システムの更新が必要です。
|
||||
|
||||
* "Conjured"アイテムは、通常のアイテムの2倍の速さで品質が劣化します。
|
||||
|
||||
すべてが正常に動作する限り、UpdateQualityメソッドに変更を加えたり、新しいコードを追加したりすることは自由に行ってください。ただし、ItemクラスやItemsプロパティは変更しないでください。
|
||||
|
||||
これらは、隅にいるゴブリンのものなので、コードの共有所有権を信じていないので、怒り狂ってあなたを一発で撃ってきます(UpdateQualityメソッドとItemsプロパティを静的にしても構いません。)
|
||||
|
||||
ただし、"Sulfuras "は伝説のアイテムであるため、Quality値は80であり、Quality値が変わることはありません。
|
||||
37
GildedRoseRequirements_kr.md
Normal file
37
GildedRoseRequirements_kr.md
Normal file
@ -0,0 +1,37 @@
|
||||
# Gilded Rose 요구사항 명세
|
||||
|
||||
안녕하세요, **Gilded Rose**에 오신 것을 환영합니다. 우리는 도시의 주요 지역에있는 작은 숙소(상점)이며, **Allison**(앨리슨)이라는 상냥한 사람이 운영하고 있습니다.
|
||||
|
||||
우리는 최고의 제품만을 구입하여 판매하고 있습니다. 불행히도, 상품 판매 기한이 가까워 질수록 품질이 저하되어가고 있습니다.
|
||||
|
||||
우리는 재고를 업데이트하는 시스템이 있습니다. 이 시스템은 지금은 새로운 모험을 떠나고 없는 **Leeroy**(리로이)라는 빡빡한 성격의 인물에 의해 개발되었습니다.
|
||||
|
||||
당신이 할 일은 시스템에 새로운 기능을 추가하여, 새로운 카테고리의 상품을 판매할 수 있도록하는 것입니다.
|
||||
|
||||
## 시스템 소개
|
||||
먼저 시스템을 소개합니다.
|
||||
|
||||
- 모든 아이템은 `SellIn` 값을 가지며, 이는 아이템을 판매해야하는 (남은) 기간을 나태냅니다.
|
||||
- 모든 아이템은 `Quality` 값을 가지며, 이것은 아이템의 가치를 나타냅니다.
|
||||
- 하루가 지날때마다, 시스템은 두 값(`SellIn`, `Quality`)을 *1* 씩 감소시킵니다.
|
||||
|
||||
간단하죠? 흥미로운 부분은 지금부터입니다.
|
||||
|
||||
- 판매하는 나머지 일수가 없어지면, `Quality` 값은 **2배**로 떨어집니다.
|
||||
- `Quality` 값은 결코 음수가 되지는 않습니다.
|
||||
- "**Aged Brie**"(오래된 브리치즈)은(는) 시간이 지날수록 `Quality` 값이 올라갑니다.
|
||||
- `Quality` 값은 50를 초과 할 수 없습니다.
|
||||
- `Sulfuras`는 전설의 아이템이므로, 반드시 판매될 필요도 없고 `Quality` 값도 떨어지지 않습니다.
|
||||
- "**Backstage passes**(백스테이지 입장권)"는 "**Aged Brie**"와 유사하게 `SellIn` 값에 가까워 질수록 `Quality` 값이 상승하고, **10일 부터는** 매일 *2* 씩 증가하다, **5일 부터는**이 되면 매일 *3* 씩 증가하지만, 콘서트 종료 후에는 *0*으로 떨어집니다.
|
||||
|
||||
## 시스템 업데이트 요구 사항
|
||||
|
||||
최근 "**Conjured**"(마법에 걸린) 상품 공급 업체와 계약했습니다. 따라서 시스템의 업데이트가 필요합니다.
|
||||
|
||||
- "**Conjured**" 아이템은 일반 아이템의 2배의 속도로 품질(`Quality`)이 저하됩니다.
|
||||
|
||||
모든 것이 제대로 작동하는 한에서는 `UpdateQuality()` 메서드를 변경하거나 새로운 코드의 추가를 자유롭게 할 수 있습니다. 그러나 `Item` 클래스와 `Items` 속성은 변경하지 마세요.
|
||||
|
||||
이것들은 저기 구석에있는 고블린의 것이고, 그 친구는 코드의 공유 소유권을 믿지 않기 때문에, 미친듯이 화를 내며(insta-rage) 여러분에게 한 방(one-shot)을 날릴 수도 있습니다. (`UpdateQuality()` 메서드와 `Items` 속성을 정적(static)으로 만드는 것은 괜찮습니다. 저희가 책임질게요.)
|
||||
|
||||
다시 한 번 확인하자면, 아이템의 `Quality`는 50 이상으로 증가할 수는 없습니다. 하지만 `Sulfuras`는 전설의 아이템이기 때문에 `Quality` 값은 80이며, 값이 바뀌지 않습니다.
|
||||
28
GildedRoseRequirements_nl.md
Normal file
28
GildedRoseRequirements_nl.md
Normal file
@ -0,0 +1,28 @@
|
||||
# Vergulde Roos Requirement Specificaties
|
||||
|
||||
Hoi en welkom bij team Vergulde Roos. Zoals je weet, zijn we een klein herberg met een uitstekende locatie in een prominente stad gerund door een vriendelijke herbergier genaamd Allison. We kopen en verkopen ook alleen de beste goederen. Helaas, onze goederen degraderen constant in kwaliteit `Quality` naarmate ze hun uiterste houdbaarheidsdatum naderen.
|
||||
|
||||
We hebben een systeem dat onze inventaris voor ons bijwerkt. Het is ontwikkeld door een no-nonsense type genaamd Leeroy, die zich op nieuwe avonturen gestort heeft. Jouw taak is om deze nieuwe functie toe te voegen aan ons systeem zodat we een nieuwe categorie items kunnen gaan verkopen. Eerst een introductie tot ons systeem:
|
||||
|
||||
- Alle artikelen `items` hebben een `SellIn` waarde die aangeeft hoeveel dagen we nog hebben om de `items` te verkopen
|
||||
- Alle `items` hebben een `Quality` (kwaliteit) waarde die aangeeft hoe waardevol het item is
|
||||
- Aan het einde van elke dag verlagen we beide waarden voor elk item in ons systeem
|
||||
|
||||
Vrij eenvoudig, toch? Nou, hier wordt het interessant:
|
||||
|
||||
- Zodra de uiterste verkoopdatum is verstreken, degradeert `Quality` twee keer zo snel
|
||||
- De `Quality` van een item is nooit negatief
|
||||
- Oude Brie __"Aged Brie"__ neemt eigenlijk toe in `Quality` naarmate het ouder wordt
|
||||
- De `Quality` van een item is nooit meer dan `50`
|
||||
- __"Sulfuras"__, als legendarisch item, hoeft nooit te worden verkocht of vermindert niet in `Quality`
|
||||
- __"Backstage passes"__, zoals aged brie, neemt toe in `Quality` naarmate de `SellIn` waarde nadert;
|
||||
- `Quality` neemt met `2` toe wanneer er `10` dagen of minder zijn en met `3` wanneer er `5` dagen of minder zijn, maar
|
||||
- `Quality` daalt naar `0` na het concert
|
||||
|
||||
We hebben onlangs een leverancier van betoverde items gecontracteerd. Dit vereist een update van ons systeem:
|
||||
|
||||
- __"Conjured"__ items degraderen in `Quality` twee keer zo snel als normale items
|
||||
|
||||
Voel je vrij om wijzigingen aan te brengen in de `UpdateQuality` methode en voeg nieuwe code toe zolang alles nog steeds correct werkt. Wijzig echter niet de `Item` klasse of `Items` eigenschap aangezien die toebehoren aan de kobold op de hoek die meteen boos wordt en je met één klap uitschakelt omdat hij niet gelooft in gedeeld codebezit (je kunt de `UpdateQuality` methode en `Items` eigenschap wel statisch maken als je wilt, we dekken je wel).
|
||||
|
||||
Voor de duidelijkheid, een item kan zijn `Quality` nooit verhogen boven `50`, echter __"Sulfuras"__ is een legendarisch item en als zodanig is zijn `Quality` `80` en verandert nooit.
|
||||
22
GildedRoseRequirements_pl.md
Normal file
22
GildedRoseRequirements_pl.md
Normal file
@ -0,0 +1,22 @@
|
||||
# Specyfikacja wymagań Pozłacanej Róży (Gilded Rose)
|
||||
|
||||
|
||||
Cześć i witaj na pokładzie zespołu Pozłacanej Róży. Jak zapewne już wiesz, jesteśmy niewielką karczmą, która znajduje się w głównej części wspaniałego miasta i jest prowadzona przez przyjazną oberżystkę o imieniu Allison. Sprzedajemy i kupujemy tylko najlepsze towary. Niestety, przedmioty te tracą na jakości w miarę jak zbliża się ich termin sprzedaży. Korzystamy z systemu, który automatycznie aktualizuje stan naszego inwentarza. System ten został napisany przez rozsądnego typka o imieniu Leeroy, który postanowił poszukać nowych przygód. Twoim zadaniem jest dodanie nowej funkcjonalności do naszego systemu tak, abyśmy mogli rozpocząć sprzedaż nowego rodzaju przedmiotów. Pozwól, że najpierw zrobię ogólne wprowadzenie do systemu:
|
||||
- Wszystkie przedmioty (`Item`) posiadają właściwość `SellIn`, która oznacza **liczbę dni pozostałych do upłynięcia terminu sprzedaży** przedmiotu
|
||||
- Wszystkie przedmioty posiadają właściwość `Quality` (**jakość**), która wpływa na wartość przedmiotu
|
||||
- Na koniec każdego dnia nasz system obniża wartość obu właściwości dla każdego przedmiotu
|
||||
|
||||
Dość proste, prawda? No cóż, teraz zrobi się bardziej interesująco:
|
||||
- Po upływie daty sprzedaży, jakość spada dwukrotnie szybciej
|
||||
- Jakość przedmiotu nigdy nie jest ujemna
|
||||
- Jakość "Starego Brie" (`Aged Brie`) rośnie wraz z wiekiem
|
||||
- Jakość przedmiotu nigdy nie przekracza 50
|
||||
- Przedmiot legendarny `Sulfuras` nigdy nie musi być sprzedany, ani nie traci na jakości
|
||||
- "Przepustka za kulisy" (`Backstage passes`), podobnie jak "Stary Brie", zyskują na jakości w miarę zbliżania się terminu sprzedaży; jakość wzrasta o 2, gdy jest 10 dni lub mniej i o 3, gdy jest 5 dni lub mniej, ale spada do 0 po koncercie (gdy `SellIn` < 0)
|
||||
|
||||
Niedawno podpisaliśmy z dostawcą kontrakt na wyczarowane przedmioty. Wymaga to wprowadzenia zmiany do naszego systemu:
|
||||
- "Wyczarowane" (`Conjured`) przedmioty tracą na jakości dwa razy szybciej niż normalne przedmioty
|
||||
|
||||
Możesz wprowadzać dowolne zmiany w metodzie `UpdateQuality`, a także dodawać nowy kod, o ile wszystko nadal działa prawidłowo. Jednak nie zmieniaj klasy `Item` ani właściwości `Items`, które zostały napisane przez goblina w rogu, gdyż zaatakuje Cię on i zabije jednym strzałem, ponieważ nie wierzy we współdzielony kod (możesz zmienić metodę `UpdateQuality` oraz właściwość `Items` na statyczne, jeśli chcesz - będziemy Cię kryć!).
|
||||
|
||||
Dla jasności: jakość przedmiotu nie może przekroczyć 50, jednak dla przedmiotu legendarnego `Sulfuras` jakość jest stale na poziomie 80 i nigdy nie spada.
|
||||
35
GildedRoseRequirements_pt-BR.md
Normal file
35
GildedRoseRequirements_pt-BR.md
Normal file
@ -0,0 +1,35 @@
|
||||
# Especificações de Requisitos de Gilded Rose
|
||||
|
||||
Bem-vindo ao time Gilded Rose. Como você deve saber, nós somos uma pequena pousada estrategicamente localizada em uma prestigiosa cidade, atendida pelo amigavel atendente Allison. Além de ser uma pousada, nós também compramos e vendemos as mercadorias de melhor qualidade. Infelizmente nossas mercadorias vão perdendo a qualidade conforme chegam próximo sua data de venda.
|
||||
|
||||
Nós temos um sistema instalado que atualiza automaticamente os preços do nosso estoque. Esse sistema foi criado por um rapaz sem noção chamado Leeroy, que agora se dedica à novas aventuras. Seu trabalho será adicionar uma nova funcionalidade para o nosso sistema para que possamos vender uma nova categoria de itens.
|
||||
|
||||
## Descrição preliminar
|
||||
|
||||
Vamos dar uma breve introdução do nosso sistema:
|
||||
|
||||
* Todos os itens (classe `Item`) possuem uma propriedade chamada `SellIn` que informa o número de dias que temos para vende-lo
|
||||
* Todos os itens possuem uma propriedade chamada `quality` que informa o quão valioso é o item.
|
||||
* No final do dia, nosso sistema decrementa os valores das propriedades `SellIn` e `quality` de cada um dos itens do estoque através do método `updateQuality`.
|
||||
|
||||
Bastante simples, não é? Bem, agora que as coisas ficam interessantes:
|
||||
|
||||
* Quando a data de venda do item tiver passado, a qualidade (`quality`) do item diminui duas vezes mais rapido.
|
||||
* A qualidade (`quality`) do item não pode ser negativa
|
||||
* O "Queijo Brie envelhecido" (`Aged Brie`), aumenta sua qualidade (`quality`) em `1` unidade a medida que envelhece.
|
||||
* A qualidade (`quality`) de um item não pode ser maior que 50.
|
||||
* O item "Sulfuras" (`Sulfuras`), por ser um item lendário, não precisa ter uma data de venda (`SellIn`) e sua qualidade (`quality`) não precisa ser diminuida.
|
||||
* O item "Entrada para os Bastidores" (`Backstage Passes`), assim como o "Queijo Brie envelhecido", aumenta sua qualidade (`quality`) a medida que o dia da venda (`SellIn`) se aproxima;
|
||||
* A qualidade (`quality`) aumenta em `2` unidades quando a data de venda (`SellIn`) é igual ou menor que `10`.
|
||||
* A qualidade (`quality`) aumenta em `3` unidades quando a data de venda (`SellIn`) é igual ou menor que `5`.
|
||||
* A qualidade (`quality`) do item vai direto à `0` quando a data de venda (`SellIn`) tiver passado.
|
||||
|
||||
Nós recentemente assinamos um suprimento de itens Conjurados Magicamente. Isto requer que nós atualizemos nosso sistema:
|
||||
|
||||
* Os itens "Conjurados" (`Conjured`) diminuem a qualidade (`quality`) duas vezes mais rápido que os outros itens.
|
||||
|
||||
Sinta-se livre para fazer qualquer alteração no método `updateQuality` e adicionar código novo contanto que tudo continue funcionando perfeitamente. Entretanto, não altere o código da classe `Item` ou da propriedade `Items` na classe `GildedRose` pois elas pertencem ao Goblin que irá te matar com um golpe pois ele não acredita na cultura de código compartilhado.
|
||||
|
||||
## Notas Finais
|
||||
|
||||
Para esclarecer: Um item não pode ter uma qualidade (`quality`) maior que `50`, entretanto as "Sulfuras" por serem um item lendário vão ter uma qualidade imutavel de `80`.
|
||||
43
GildedRoseRequirements_ru.txt
Normal file
43
GildedRoseRequirements_ru.txt
Normal file
@ -0,0 +1,43 @@
|
||||
======================================
|
||||
Технические требования «Gilded Rose»
|
||||
======================================
|
||||
|
||||
Привет и добро пожаловать в команду «Gilded Rose». Как вы знаете, мы небольшая гостиница удобно расположенная
|
||||
в известном городе под руководством дружественного управляющего по имени Эллисон. Также мы занимаемся покупкой
|
||||
и продажей только самых лучших товаров. К несчастью, качество наших товаров постоянно ухудшается по мере приближения
|
||||
к максимальному сроку хранения. Существует информационная система, которая ведет переучет всех товаров. Система
|
||||
была разработана рубаха-парнем, по имени Leeroy, который отправился за поисками новых приключений. Ваша задача
|
||||
заключается в том, чтобы добавить новый функционал в нашу систему, чтобы мы могли начать продавать новую категорию
|
||||
товаров.
|
||||
|
||||
В общих чертах система работает следующим образом:
|
||||
|
||||
- Все товары имеют свойство «sellIn» (срок хранения), которое обозначает количество
|
||||
дней в течение которых мы должны продать товар;
|
||||
- Все товары имеют свойство «Quality» (качество), которое обозначает насколько качественным является товар;
|
||||
- В конце дня наша система снижает значение обоих свойств для каждого товара.
|
||||
|
||||
Довольно просто, не правда ли? Тут-то и начинается самое интересное:
|
||||
|
||||
- После того, как срок храния прошел, качество товара ухудшается в два раза быстрее;
|
||||
- Качество товара никогда не может быть отрицательным;
|
||||
- Для товара «Aged Brie» качество увеличивается пропорционально возрасту;
|
||||
- Качество товара никогда не может быть больше, чем 50;
|
||||
- «Sulfuras» является легендарным товаром, поэтому у него нет срока хранения и не подвержен ухудшению качества;
|
||||
- Качество «Backstage passes» также, как и «Aged Brie», увеличивается по мере приближения к сроку хранения.
|
||||
Качество увеличивается на 2, когда до истечения срока хранения 10 или менее дней и на 3,
|
||||
если до истечения 5 или менее дней. При этом качество падает до 0 после даты проведения концерта.
|
||||
|
||||
Недавно мы нашли поставщика магических товаров. Для того, чтобы продавать его товары необходимо обновить нашу
|
||||
систему следующим образом:
|
||||
|
||||
- «Conjured» товары теряют качество в два раза быстрее, чем обычные товары.
|
||||
|
||||
Не стесняйтесь вносить любые изменения в метод «UpdateQuality» и добавлять любой новый код до тех пор,
|
||||
пока система работает корректно. Тем не менее, не меняйте класс «Item» или его свойства, так как он принадлежит
|
||||
сидящему в углу гоблину, который очень яростен и поэтому выстрелит в вас поскольку не верит в принцип
|
||||
совместного владения кодом (вы можете сделать метод «UpdateQuality» и свойства класса «Item» статическими
|
||||
если хотите, мы вас прикроем).
|
||||
|
||||
Просто для уточнения, товар никогда не может иметь качество выше чем 50, однако легендарный товар «Sulfuras»
|
||||
имеет качество 80 и оно никогда не меняется.
|
||||
37
GildedRoseRequirements_th.md
Normal file
37
GildedRoseRequirements_th.md
Normal file
@ -0,0 +1,37 @@
|
||||
# ข้อกำหนดความต้องการของระบบ Gilded Rose
|
||||
|
||||
ยินดีต้อนรับสู่ทีม Gilded Rose อย่างที่คุณทราบแล้วว่า เราคือโรงแรมขนาดเล็กที่ตั้งอยู่ทำเลทองของประเทศกรุงเทพ
|
||||
นอกจากนี้เรายังซื้อและขายเฉพาะสินค้าที่ดีที่สุด แต่น่าเสียดายยิ่งใกล้ถึงวันกำหนดขายสินค้า คุณภาพของสินค้าก็จะลดลงอย่างต่อเนื่อง
|
||||
ตอนนี้เรามีระบบที่ช่วยอัปเดตสินค้าคงคลังให้เรา มันถูกพัฒนาโดยโปรแกรมเมอร์ศิษย์เอกของพระอินทร์ ซึ่งโปรแกรมเมอร์คนนี้ได้ย้ายกลับไปอยู่กับพระอินทร์
|
||||
เป็นการถาวรแล้ว เราจึงอยากให้คุณช่วยเพิ่มฟีเจอร์ใหม่เพื่อให้เราสามารถขายสินค้าประเภทใหม่ได้
|
||||
|
||||
ก่อนอื่นเราขอแนะนำการทำงานของระบบปัจจุบัน:
|
||||
|
||||
- สินค้าแต่ละชิ้นจะต้องขายภายในระยะเวลาที่กำหนดไว้ในค่า "SellIn" (มีหน่วยเป็น*วัน*)
|
||||
- สินค้าแต่ละชิ้นจะระบุค่า "Quality" ที่สามารถบ่งชี้ถึงมูลค่าของสินค้า
|
||||
- ระบบจะทำการคำนวนค่า "SellIn" และ "Quality" ของสินค้าทุกชิ้นในช่วงเวลาสุดท้ายของทุกวัน
|
||||
|
||||
ง่ายอะดิ, ใช่ป่ะ? สิ่งที่น่าสนใจมันอยู่ตรงนี้:
|
||||
|
||||
- เมื่อสินค้าเลยกำหนดขายไปแล้ว "Quality" ของสินค้าจะลดลงเป็นสองเท่าจากปกติ
|
||||
- "Quality" ของสินค้าไม่มีทางติดลบได้
|
||||
- คุณภาพของสินค้าประเภท "Aged Brie" จะเพิ่มสูงขึ้นตามระยะเวลา
|
||||
- "Quality" มีค่าสูงสุดคือ 50
|
||||
- สินค้าประเภท "Sulfuras" เป็นสินค้าในตำนานหายาก คุณภาพของสินค้าจะไม่ลดลงและไม่ได้มีไว้เพื่อขาย
|
||||
- สินค้าประเภท "Backstage passes" คุณภาพของสินค้าเหมือนกันกับสินค้าประเภท aged brie
|
||||
เพียงแต่หากใกล้ถึงวันแสดง 10 วันก่อนหน้าหรือน้อยกว่าคุณภาพของสินค้าประเภทนี้จะเพิ่มทีละ 2 และถ้าใกล้ถึงวันก่อนวันแสดง 5 วันหรือน้อยกว่าคุณภาพจะเพิ่มทีละ 3
|
||||
อย่างไรก็ตามคุณภาพของสินค้าจะกลายเป็น 0 ทันทีหลังการแสดงจบลง
|
||||
|
||||
เมื่อเร็วๆ นี้เราพึ่งได้ลงนามกับผู้ผลิตสินค้าประเภทของขลังและของปลุกเสก
|
||||
และเราต้องการที่จะเพิ่มความสามารถใหม่เข้าไปในระบบ:
|
||||
|
||||
- คุณภาพสินค้าประเภท "Conjured" จะเสื่อมลงเร็วกว่าสินค้าปกติถึงสองเท่าจากปกติ
|
||||
|
||||
คุณสามารถปรับปรุงแก้ไขได้ทุกอย่างภายในเมธอด UpdateQuality และสามารถเพิ่มโค้ดใหม่ได้เลย
|
||||
ตราบใดที่ทุกอย่างยังคงทำงานได้ถูกต้อง อย่างไรก็ตามห้ามแก้ไขคลาส Item และคุณสมบัติของคลาส
|
||||
เพราะมันถูกลงอาคมจากโปรแกรมเมอร์จอมขมังเวทย์ที่ไม่เชื่อในเรื่องการแบ่งปันความเป็นเจ้าของโค้ดร่วมกับผู้อื่น
|
||||
(ถ้าคุณยังอยากจะแก้ไขทั้งเมธอด UpdateQuality และคุณสมบัติของคลาส Item เราก็จะ
|
||||
นิมนต์หลวงปู่เค็มมาช่วยคุ้มกันคุณ)
|
||||
|
||||
ย้ำอีกครั้งหนึ่ง, คุณภาพของสินค้ามีค่าสูงสุดคือ 50
|
||||
อย่างไรก็ตามสินค้าประเภท "Sulfuras" เป็นสินค้าหายากในตำนานมีค่า Quality เป็น 80 เสมอไม่เปลี่ยนแปลง.
|
||||
32
GildedRoseRequirements_zh.txt
Normal file
32
GildedRoseRequirements_zh.txt
Normal file
@ -0,0 +1,32 @@
|
||||
======================================
|
||||
Gilded Rose 需求描述
|
||||
======================================
|
||||
|
||||
|
||||
欢迎来到镶金玫瑰(Gilded Rose)团队。如你所知,我们是主城(暴风城)中的一个小旅店,店主非常友好,名叫Allison。我们也售卖最好的物品。不幸的是,物品品质会随着销售期限的接近而不断下降。
|
||||
我们有一个系统来更新库存信息。系统是由一个火车王(魔兽世界中导致团灭的猪队友)Leeroy所开发的,他已经不在这了。
|
||||
你的任务是添加新功能,这样我们就可以售卖新的物品。
|
||||
|
||||
先介绍一下我们的系统:
|
||||
|
||||
- 每种物品都具备一个销售期限`SellIn`,表示我们要在多少天之前把物品卖出去
|
||||
- 每种的物品都具备品质值`Quality`,表示物品的品质
|
||||
- 每天结束时,系统会降低每种物品的这两个数值
|
||||
|
||||
很简单吧?这还有些更有意思的:
|
||||
|
||||
- 一旦销售期限过期,品质`Quality`会以双倍速度加速下降
|
||||
- 物品的品质`Quality`永远不会为负值
|
||||
- "Aged Brie"(陈年布利奶酪)的品质`Quality`会随着时间推移而提高
|
||||
- 物品的品质`Quality`永远不会超过50
|
||||
- 传奇物品"Sulfuras"(萨弗拉斯—炎魔拉格纳罗斯之手)永不过期,也不会降低品质`Quality`
|
||||
- "Backstage passes"(后台通行证)与"Aged Brie"(陈年布利奶酪)类似,其品质`Quality`会随着时间推移而提高;当还剩10天或更少的时候,品质`Quality`每天提高2;当还剩5天或更少的时候,品质`Quality`每天提高3;但一旦过期,品质就会降为0
|
||||
|
||||
|
||||
我们最近签约了一个召唤物品供应商。这需要对我们的系统进行升级:
|
||||
|
||||
- "Conjured"(召唤物品)的品质`Quality`下降速度比正常物品快一倍
|
||||
|
||||
请随意对**UpdateQuality()**函数进行修改和添加新代码,只要系统还能正常工作。然而,不要修改Item类或其属性,因为那属于角落里的地精,他会非常愤怒地爆你头,因为他不相信代码共享所有制(如果你愿意,你可以将UpdateQuality方法和Items属性改为静态的,我们会掩护你的)。
|
||||
|
||||
再次澄清,每种物品的品质不会超过50,然而"Sulfuras"(萨弗拉斯—炎魔拉格纳罗斯之手)是一个传奇物品,因此它的品质是80且永远不变。
|
||||
96
Groovy/.gitignore
vendored
Normal file
96
Groovy/.gitignore
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
|
||||
# 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/
|
||||
|
||||
## File-based project format:
|
||||
*.iws
|
||||
*.iml
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Gradle
|
||||
.gradle
|
||||
build/
|
||||
|
||||
### 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
|
||||
22
Groovy/.idea/compiler.xml
Normal file
22
Groovy/.idea/compiler.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?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>
|
||||
3
Groovy/.idea/copyright/profiles_settings.xml
Normal file
3
Groovy/.idea/copyright/profiles_settings.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="" />
|
||||
</component>
|
||||
26
Groovy/.idea/misc.xml
Normal file
26
Groovy/.idea/misc.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?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>
|
||||
8
Groovy/.idea/modules.xml
Normal file
8
Groovy/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?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>
|
||||
17
Groovy/README.txt
Normal file
17
Groovy/README.txt
Normal file
@ -0,0 +1,17 @@
|
||||
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
|
||||
|
||||
22
Groovy/build.gradle
Normal file
22
Groovy/build.gradle
Normal file
@ -0,0 +1,22 @@
|
||||
plugins {
|
||||
id 'groovy'
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
sourceCompatibility = '1.8'
|
||||
targetCompatibility = '1.8'
|
||||
group='com.gildedrose'
|
||||
|
||||
dependencies {
|
||||
implementation 'org.codehaus.groovy:groovy:3.0.12'
|
||||
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.6.2'
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
5
Groovy/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
Groovy/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
185
Groovy/gradlew
vendored
Executable file
185
Groovy/gradlew
vendored
Executable file
@ -0,0 +1,185 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MSYS* | MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
89
Groovy/gradlew.bat
vendored
Normal file
89
Groovy/gradlew.bat
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
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 execute
|
||||
|
||||
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
|
||||
|
||||
: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 %*
|
||||
|
||||
: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
|
||||
62
Groovy/src/main/groovy/com/gildedrose/GildedRose.groovy
Normal file
62
Groovy/src/main/groovy/com/gildedrose/GildedRose.groovy
Normal file
@ -0,0 +1,62 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
Groovy/src/main/groovy/com/gildedrose/Item.groovy
Normal file
21
Groovy/src/main/groovy/com/gildedrose/Item.groovy
Normal file
@ -0,0 +1,21 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
15
Groovy/src/test/groovy/com/gildedrose/GildedRoseTest.groovy
Normal file
15
Groovy/src/test/groovy/com/gildedrose/GildedRoseTest.groovy
Normal file
@ -0,0 +1,15 @@
|
||||
package com.gildedrose
|
||||
|
||||
import org.junit.jupiter.api.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
|
||||
}
|
||||
|
||||
}
|
||||
32
Groovy/src/test/groovy/com/gildedrose/TexttestFixture.groovy
Normal file
32
Groovy/src/test/groovy/com/gildedrose/TexttestFixture.groovy
Normal file
@ -0,0 +1,32 @@
|
||||
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()
|
||||
}
|
||||
6
Java-Approvals/.editorconfig
Normal file
6
Java-Approvals/.editorconfig
Normal file
@ -0,0 +1,6 @@
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
13
Java-Approvals/.gitignore
vendored
Normal file
13
Java-Approvals/.gitignore
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
.idea/
|
||||
*.iml
|
||||
target/
|
||||
|
||||
.classpath
|
||||
.project
|
||||
bin/
|
||||
.settings/
|
||||
|
||||
# Gradle
|
||||
.gradle
|
||||
/build/
|
||||
|
||||
117
Java-Approvals/.mvn/wrapper/MavenWrapperDownloader.java
vendored
Normal file
117
Java-Approvals/.mvn/wrapper/MavenWrapperDownloader.java
vendored
Normal file
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright 2007-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.nio.channels.*;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MavenWrapperDownloader {
|
||||
|
||||
private static final String WRAPPER_VERSION = "0.5.6";
|
||||
/**
|
||||
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
|
||||
*/
|
||||
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
|
||||
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
|
||||
|
||||
/**
|
||||
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
|
||||
* use instead of the default one.
|
||||
*/
|
||||
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
|
||||
".mvn/wrapper/maven-wrapper.properties";
|
||||
|
||||
/**
|
||||
* Path where the maven-wrapper.jar will be saved to.
|
||||
*/
|
||||
private static final String MAVEN_WRAPPER_JAR_PATH =
|
||||
".mvn/wrapper/maven-wrapper.jar";
|
||||
|
||||
/**
|
||||
* Name of the property which should be used to override the default download url for the wrapper.
|
||||
*/
|
||||
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
|
||||
|
||||
public static void main(String args[]) {
|
||||
System.out.println("- Downloader started");
|
||||
File baseDirectory = new File(args[0]);
|
||||
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
|
||||
|
||||
// If the maven-wrapper.properties exists, read it and check if it contains a custom
|
||||
// wrapperUrl parameter.
|
||||
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
|
||||
String url = DEFAULT_DOWNLOAD_URL;
|
||||
if(mavenWrapperPropertyFile.exists()) {
|
||||
FileInputStream mavenWrapperPropertyFileInputStream = null;
|
||||
try {
|
||||
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
|
||||
Properties mavenWrapperProperties = new Properties();
|
||||
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
|
||||
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
|
||||
} catch (IOException e) {
|
||||
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
|
||||
} finally {
|
||||
try {
|
||||
if(mavenWrapperPropertyFileInputStream != null) {
|
||||
mavenWrapperPropertyFileInputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// Ignore ...
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("- Downloading from: " + url);
|
||||
|
||||
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
|
||||
if(!outputFile.getParentFile().exists()) {
|
||||
if(!outputFile.getParentFile().mkdirs()) {
|
||||
System.out.println(
|
||||
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
|
||||
}
|
||||
}
|
||||
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
|
||||
try {
|
||||
downloadFileFromURL(url, outputFile);
|
||||
System.out.println("Done");
|
||||
System.exit(0);
|
||||
} catch (Throwable e) {
|
||||
System.out.println("- Error downloading");
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
|
||||
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
|
||||
String username = System.getenv("MVNW_USERNAME");
|
||||
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
|
||||
Authenticator.setDefault(new Authenticator() {
|
||||
@Override
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(username, password);
|
||||
}
|
||||
});
|
||||
}
|
||||
URL website = new URL(urlString);
|
||||
ReadableByteChannel rbc;
|
||||
rbc = Channels.newChannel(website.openStream());
|
||||
FileOutputStream fos = new FileOutputStream(destination);
|
||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||
fos.close();
|
||||
rbc.close();
|
||||
}
|
||||
|
||||
}
|
||||
BIN
Java-Approvals/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
BIN
Java-Approvals/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
Binary file not shown.
18
Java-Approvals/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
18
Java-Approvals/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
|
||||
10
Java-Approvals/README.md
Normal file
10
Java-Approvals/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Gilded Rose in Java with Approval Tests
|
||||
|
||||
This folder has a unit test that uses [Approvals](https://github.com/approvals/approvaltests.java)
|
||||
|
||||
There are two test cases here with different styles:
|
||||
|
||||
* "foo" is more similar to the unit test from the 'Java' version
|
||||
* "thirtyDays" is more similar to the TextTest from the 'Java' version
|
||||
|
||||
I suggest choosing one style to develop and deleting the other.
|
||||
22
Java-Approvals/build.gradle
Normal file
22
Java-Approvals/build.gradle
Normal file
@ -0,0 +1,22 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.6.2'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.6.2'
|
||||
testImplementation 'com.approvaltests:approvaltests:12.3.1'
|
||||
}
|
||||
|
||||
group = 'com.gildedrose'
|
||||
version = '0.0.1-SNAPSHOT'
|
||||
sourceCompatibility = '1.8'
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
BIN
Java-Approvals/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
Java-Approvals/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
Java-Approvals/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
Java-Approvals/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
183
Java-Approvals/gradlew
vendored
Executable file
183
Java-Approvals/gradlew
vendored
Executable file
@ -0,0 +1,183 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
100
Java-Approvals/gradlew.bat
vendored
Normal file
100
Java-Approvals/gradlew.bat
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
316
Java-Approvals/mvnw
vendored
Executable file
316
Java-Approvals/mvnw
vendored
Executable file
@ -0,0 +1,316 @@
|
||||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Maven Start Up Batch script
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# JAVA_HOME - location of a JDK home dir
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# M2_HOME - location of maven2's installed home dir
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
# e.g. to debug Maven itself, use
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||
|
||||
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||
. /usr/local/etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f /etc/mavenrc ] ; then
|
||||
. /etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.mavenrc" ] ; then
|
||||
. "$HOME/.mavenrc"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# OS specific support. $var _must_ be set to either true or false.
|
||||
cygwin=false;
|
||||
darwin=false;
|
||||
mingw=false
|
||||
case "`uname`" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
Darwin*) darwin=true
|
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
if [ -x "/usr/libexec/java_home" ]; then
|
||||
export JAVA_HOME="`/usr/libexec/java_home`"
|
||||
else
|
||||
export JAVA_HOME="/Library/Java/Home"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
if [ -r /etc/gentoo-release ] ; then
|
||||
JAVA_HOME=`java-config --jre-home`
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$M2_HOME" ] ; then
|
||||
## resolve links - $0 may be a link to maven's home
|
||||
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
|
||||
|
||||
saveddir=`pwd`
|
||||
|
||||
M2_HOME=`dirname "$PRG"`/..
|
||||
|
||||
# make it fully qualified
|
||||
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||
|
||||
cd "$saveddir"
|
||||
# echo Using m2 at $M2_HOME
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --unix "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
||||
fi
|
||||
|
||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||
if $mingw ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
javaExecutable="`which javac`"
|
||||
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
||||
# readlink(1) is not available as standard on Solaris 10.
|
||||
readLink=`which readlink`
|
||||
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
||||
if $darwin ; then
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
||||
else
|
||||
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
||||
fi
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
||||
JAVA_HOME="$javaHome"
|
||||
export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$JAVACMD" ] ; then
|
||||
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
|
||||
else
|
||||
JAVACMD="`\\unset -f command; \\command -v java`"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||
echo " We cannot execute $JAVACMD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
echo "Warning: JAVA_HOME environment variable is not set."
|
||||
fi
|
||||
|
||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
||||
|
||||
# traverses directory structure from process work directory to filesystem root
|
||||
# first directory with .mvn subdirectory is considered project base directory
|
||||
find_maven_basedir() {
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Path not specified to find_maven_basedir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
basedir="$1"
|
||||
wdir="$1"
|
||||
while [ "$wdir" != '/' ] ; do
|
||||
if [ -d "$wdir"/.mvn ] ; then
|
||||
basedir=$wdir
|
||||
break
|
||||
fi
|
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||
if [ -d "${wdir}" ]; then
|
||||
wdir=`cd "$wdir/.."; pwd`
|
||||
fi
|
||||
# end of workaround
|
||||
done
|
||||
echo "${basedir}"
|
||||
}
|
||||
|
||||
# concatenates all lines of a file
|
||||
concat_lines() {
|
||||
if [ -f "$1" ]; then
|
||||
echo "$(tr -s '\n' ' ' < "$1")"
|
||||
fi
|
||||
}
|
||||
|
||||
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
||||
if [ -z "$BASE_DIR" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
##########################################################################################
|
||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
##########################################################################################
|
||||
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
||||
fi
|
||||
else
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
||||
fi
|
||||
if [ -n "$MVNW_REPOURL" ]; then
|
||||
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
else
|
||||
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
fi
|
||||
while IFS="=" read key value; do
|
||||
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
||||
esac
|
||||
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Downloading from: $jarUrl"
|
||||
fi
|
||||
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
||||
if $cygwin; then
|
||||
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
||||
fi
|
||||
|
||||
if command -v wget > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found wget ... using wget"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
else
|
||||
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
elif command -v curl > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found curl ... using curl"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
curl -o "$wrapperJarPath" "$jarUrl" -f
|
||||
else
|
||||
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
||||
fi
|
||||
|
||||
else
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Falling back to using Java to download"
|
||||
fi
|
||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||
# For Cygwin, switch paths to Windows format before running javac
|
||||
if $cygwin; then
|
||||
javaClass=`cygpath --path --windows "$javaClass"`
|
||||
fi
|
||||
if [ -e "$javaClass" ]; then
|
||||
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo " - Compiling MavenWrapperDownloader.java ..."
|
||||
fi
|
||||
# Compiling the Java class
|
||||
("$JAVA_HOME/bin/javac" "$javaClass")
|
||||
fi
|
||||
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||
# Running the downloader
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo " - Running MavenWrapperDownloader.java ..."
|
||||
fi
|
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
##########################################################################################
|
||||
# End of extension
|
||||
##########################################################################################
|
||||
|
||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo $MAVEN_PROJECTBASEDIR
|
||||
fi
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
||||
fi
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
$MAVEN_DEBUG_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.home=${M2_HOME}" \
|
||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
||||
188
Java-Approvals/mvnw.cmd
vendored
Normal file
188
Java-Approvals/mvnw.cmd
vendored
Normal file
@ -0,0 +1,188 @@
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM http://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Maven Start Up Batch script
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM M2_HOME - location of maven2's installed home dir
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
@REM e.g. to debug Maven itself, use
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||
@echo off
|
||||
@REM set title of command window
|
||||
title %0
|
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||
:skipRcPre
|
||||
|
||||
@setlocal
|
||||
|
||||
set ERROR_CODE=0
|
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||
@setlocal
|
||||
|
||||
@REM ==== START VALIDATION ====
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME not found in your environment. >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
:OkJHome
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
@REM ==== END VALIDATION ====
|
||||
|
||||
:init
|
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||
@REM Fallback to current working directory if not found.
|
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||
|
||||
set EXEC_DIR=%CD%
|
||||
set WDIR=%EXEC_DIR%
|
||||
:findBaseDir
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||
cd ..
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||
set WDIR=%CD%
|
||||
goto findBaseDir
|
||||
|
||||
:baseDirFound
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||
cd "%EXEC_DIR%"
|
||||
goto endDetectBaseDir
|
||||
|
||||
:baseDirNotFound
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||
cd "%EXEC_DIR%"
|
||||
|
||||
:endDetectBaseDir
|
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||
|
||||
:endReadAdditionalConfig
|
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
||||
)
|
||||
|
||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
if exist %WRAPPER_JAR% (
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Found %WRAPPER_JAR%
|
||||
)
|
||||
) else (
|
||||
if not "%MVNW_REPOURL%" == "" (
|
||||
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %DOWNLOAD_URL%
|
||||
)
|
||||
|
||||
powershell -Command "&{"^
|
||||
"$webclient = new-object System.Net.WebClient;"^
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||
"}"^
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||
@REM work with both Windows and non-Windows executions.
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
%MAVEN_JAVA_EXE% ^
|
||||
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||
%MAVEN_OPTS% ^
|
||||
%MAVEN_DEBUG_OPTS% ^
|
||||
-classpath %WRAPPER_JAR% ^
|
||||
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||
:skipRcPost
|
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||
|
||||
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||
|
||||
cmd /C exit /B %ERROR_CODE%
|
||||
54
Java-Approvals/pom.xml
Normal file
54
Java-Approvals/pom.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<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>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<junit.jupiter.version>5.10.2</junit.jupiter.version>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>${junit.jupiter.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-params</artifactId>
|
||||
<version>${junit.jupiter.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit.jupiter.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.approvaltests</groupId>
|
||||
<artifactId>approvaltests</artifactId>
|
||||
<version>24.2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<source>22</source>
|
||||
<target>22</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
1
Java-Approvals/settings.gradle
Normal file
1
Java-Approvals/settings.gradle
Normal file
@ -0,0 +1 @@
|
||||
rootProject.name = 'gilded-rose-kata'
|
||||
62
Java-Approvals/src/main/java/com/gildedrose/GildedRose.java
Normal file
62
Java-Approvals/src/main/java/com/gildedrose/GildedRose.java
Normal file
@ -0,0 +1,62 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
Java-Approvals/src/main/java/com/gildedrose/Item.java
Normal file
21
Java-Approvals/src/main/java/com/gildedrose/Item.java
Normal file
@ -0,0 +1,21 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
32
Java-Approvals/src/main/java/com/gildedrose/Program.java
Normal file
32
Java-Approvals/src/main/java/com/gildedrose/Program.java
Normal file
@ -0,0 +1,32 @@
|
||||
package com.gildedrose;
|
||||
|
||||
public class Program {
|
||||
|
||||
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);
|
||||
|
||||
for (int i = 0; i < 31; i++) {
|
||||
System.out.println("-------- day " + i + " --------");
|
||||
System.out.println("name, sellIn, quality");
|
||||
for (int j = 0; j < items.length; j++) {
|
||||
System.out.println(items[j]);
|
||||
}
|
||||
System.out.println("");
|
||||
app.updateQuality();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.gildedrose;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
|
||||
import org.approvaltests.Approvals;
|
||||
import org.approvaltests.reporters.DiffReporter;
|
||||
import org.approvaltests.reporters.UseReporter;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
@UseReporter(DiffReporter.class)
|
||||
public class GildedRoseApprovalTest {
|
||||
|
||||
@Test
|
||||
public void foo() {
|
||||
|
||||
Item[] items = new Item[] { new Item("foo", 0, 0) };
|
||||
GildedRose app = new GildedRose(items);
|
||||
app.updateQuality();
|
||||
|
||||
Approvals.verifyAll("Items", items);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void thirtyDays() {
|
||||
|
||||
ByteArrayOutputStream fakeoutput = new ByteArrayOutputStream();
|
||||
System.setOut(new PrintStream(fakeoutput));
|
||||
System.setIn(new ByteArrayInputStream("a\n".getBytes()));
|
||||
|
||||
Program.main();
|
||||
String output = fakeoutput.toString();
|
||||
|
||||
Approvals.verify(output);
|
||||
}
|
||||
}
|
||||
4
Java-Cucumber/.gitignore
vendored
Normal file
4
Java-Cucumber/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
.idea/
|
||||
.gradle/
|
||||
build/
|
||||
target/
|
||||
117
Java-Cucumber/.mvn/wrapper/MavenWrapperDownloader.java
vendored
Normal file
117
Java-Cucumber/.mvn/wrapper/MavenWrapperDownloader.java
vendored
Normal file
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright 2007-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.nio.channels.*;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MavenWrapperDownloader {
|
||||
|
||||
private static final String WRAPPER_VERSION = "0.5.6";
|
||||
/**
|
||||
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
|
||||
*/
|
||||
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
|
||||
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
|
||||
|
||||
/**
|
||||
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
|
||||
* use instead of the default one.
|
||||
*/
|
||||
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
|
||||
".mvn/wrapper/maven-wrapper.properties";
|
||||
|
||||
/**
|
||||
* Path where the maven-wrapper.jar will be saved to.
|
||||
*/
|
||||
private static final String MAVEN_WRAPPER_JAR_PATH =
|
||||
".mvn/wrapper/maven-wrapper.jar";
|
||||
|
||||
/**
|
||||
* Name of the property which should be used to override the default download url for the wrapper.
|
||||
*/
|
||||
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
|
||||
|
||||
public static void main(String args[]) {
|
||||
System.out.println("- Downloader started");
|
||||
File baseDirectory = new File(args[0]);
|
||||
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
|
||||
|
||||
// If the maven-wrapper.properties exists, read it and check if it contains a custom
|
||||
// wrapperUrl parameter.
|
||||
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
|
||||
String url = DEFAULT_DOWNLOAD_URL;
|
||||
if(mavenWrapperPropertyFile.exists()) {
|
||||
FileInputStream mavenWrapperPropertyFileInputStream = null;
|
||||
try {
|
||||
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
|
||||
Properties mavenWrapperProperties = new Properties();
|
||||
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
|
||||
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
|
||||
} catch (IOException e) {
|
||||
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
|
||||
} finally {
|
||||
try {
|
||||
if(mavenWrapperPropertyFileInputStream != null) {
|
||||
mavenWrapperPropertyFileInputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// Ignore ...
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("- Downloading from: " + url);
|
||||
|
||||
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
|
||||
if(!outputFile.getParentFile().exists()) {
|
||||
if(!outputFile.getParentFile().mkdirs()) {
|
||||
System.out.println(
|
||||
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
|
||||
}
|
||||
}
|
||||
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
|
||||
try {
|
||||
downloadFileFromURL(url, outputFile);
|
||||
System.out.println("Done");
|
||||
System.exit(0);
|
||||
} catch (Throwable e) {
|
||||
System.out.println("- Error downloading");
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
|
||||
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
|
||||
String username = System.getenv("MVNW_USERNAME");
|
||||
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
|
||||
Authenticator.setDefault(new Authenticator() {
|
||||
@Override
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(username, password);
|
||||
}
|
||||
});
|
||||
}
|
||||
URL website = new URL(urlString);
|
||||
ReadableByteChannel rbc;
|
||||
rbc = Channels.newChannel(website.openStream());
|
||||
FileOutputStream fos = new FileOutputStream(destination);
|
||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||
fos.close();
|
||||
rbc.close();
|
||||
}
|
||||
|
||||
}
|
||||
BIN
Java-Cucumber/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
BIN
Java-Cucumber/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user