projects
/
JavaForFun
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
39686d6
)
Writing test for VII
author
Gustavo Martin Morcuende
<gu.martinm@gmail.com>
Sun, 27 Nov 2016 16:49:42 +0000
(17:49 +0100)
committer
Gustavo Martin Morcuende
<gu.martinm@gmail.com>
Sun, 27 Nov 2016 16:49:42 +0000
(17:49 +0100)
TDD/sandromancuso/romannumerals/src/main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java
patch
|
blob
|
history
TDD/sandromancuso/romannumerals/src/test/java/org/craftedsw/romannumerals/RomanNumeralsGeneratorShould.java
patch
|
blob
|
history
diff --git
a/TDD/sandromancuso/romannumerals/src/main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java
b/TDD/sandromancuso/romannumerals/src/main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java
index
0dabe1f
..
17bc8f3
100644
(file)
--- a/
TDD/sandromancuso/romannumerals/src/main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java
+++ b/
TDD/sandromancuso/romannumerals/src/main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java
@@
-4,8
+4,9
@@
public class RomanNumeralGenerator {
public static String romanFor(int decimal) {
String roman = "";
- if (decimal == 5) {
- return "V";
+ if (decimal >= 5) {
+ roman += "V";
+ decimal -= 5;
}
for (int i = 0; i < decimal; i++) {
roman += "I";
diff --git
a/TDD/sandromancuso/romannumerals/src/test/java/org/craftedsw/romannumerals/RomanNumeralsGeneratorShould.java
b/TDD/sandromancuso/romannumerals/src/test/java/org/craftedsw/romannumerals/RomanNumeralsGeneratorShould.java
index
c741117
..
ed9e0d8
100644
(file)
--- a/
TDD/sandromancuso/romannumerals/src/test/java/org/craftedsw/romannumerals/RomanNumeralsGeneratorShould.java
+++ b/
TDD/sandromancuso/romannumerals/src/test/java/org/craftedsw/romannumerals/RomanNumeralsGeneratorShould.java
@@
-22,6
+22,7
@@
public class RomanNumeralsGeneratorShould {
// going to be more complicated and we do not already have
// the pattern to extract the algorithm for the IV number.
assertThat(romanFor(5), is("V"));
+ assertThat(romanFor(7), is("VII"));
}
}