-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Anarak404 PR of Rewrite tests - but with resolved conflicts and adde…
…d new languages (#173) * #147 | feat(tests): separate integer and long values tests * #147 | feat(tests): adjust bulgarian values tests * #147 | feat(tests): adjust croatian values tests * #147 | feat(tests): adjust czech values tests * #147 | feat(tests): adjust dutch values tests * #147 | feat(tests): adjust french values tests * #147 | feat(tests): adjust german values tests * #147 | feat(tests): adjust hindi values tests * #147 | feat(tests): adjust italian values tests * #147 | feat(tests): adjust kazakh values tests * #147 | feat(tests): adjust latvian values tests * #147 | feat(tests): adjust polish values tests * #147 | feat(tests): adjust portuguese values tests * #147 | feat(tests): adjust russian values tests * #147 | feat(tests): adjust serbian values tests * #147 | feat(tests): adjust slovak values tests * #147 | feat(tests): adjust slovene values tests * #147 | feat(tests): adjust spanish values tests * #147 | feat(tests): adjust swedish values tests * #147 | feat(tests): adjust turkish values tests * #147 | feat(tests): adjust ukrainian values tests * #147 | feat(tests): add missing translates * merge tests by Anarak404 * resolve conflict in spanish tests, rewrite serbian + japanese --------- Co-authored-by: Anarak404 <[email protected]>
- Loading branch information
Showing
57 changed files
with
3,077 additions
and
3,260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...est/groovy/pl/allegro/finance/tradukisto/internal/languages/AbstractLongValuesTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package pl.allegro.finance.tradukisto.internal.languages | ||
|
||
import pl.allegro.finance.tradukisto.internal.LongToStringConverter | ||
import spock.lang.Specification | ||
import spock.lang.Unroll | ||
|
||
abstract class AbstractLongValuesTest extends Specification { | ||
abstract LongValuesTestData testData | ||
abstract LongToStringConverter longConverter | ||
|
||
private static final OBLIGATORY_LONG_VALUES = [ | ||
5_000_000_000, | ||
1_000_000_000_000, | ||
2_000_000_000_000, | ||
5_000_000_000_000, | ||
1_000_000_000_000_000, | ||
2_000_000_000_000_000, | ||
5_000_000_000_000_000, | ||
1_000_000_000_000_000_000, | ||
2_000_000_000_000_000_000, | ||
Long.MAX_VALUE | ||
] | ||
|
||
@Unroll | ||
def "should convert long #input to #output"() { | ||
expect: | ||
longConverter.asWords(input) == output | ||
|
||
where: | ||
input << getTestData().getLongTranslations().keySet() | ||
output << getTestData().getLongTranslations().values() | ||
} | ||
|
||
static class LongValuesTestData { | ||
private final Map<Long, String> longTranslations | ||
|
||
LongValuesTestData(Map<Long, String> longTranslations) { | ||
this.longTranslations = prepareLongInput(longTranslations) | ||
} | ||
|
||
Map<Long, String> getLongTranslations() { | ||
return longTranslations | ||
} | ||
|
||
private static prepareLongInput(Map<Long, String> longWords) { | ||
OBLIGATORY_LONG_VALUES.stream() | ||
.forEach { | ||
longWords.putIfAbsent(it, "⚠️Please specify expected output") | ||
} | ||
return longWords.sort { it.key } | ||
} | ||
} | ||
} |
106 changes: 106 additions & 0 deletions
106
...allegro/finance/tradukisto/internal/languages/bulgarian/BulgarianIntegerValuesTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package pl.allegro.finance.tradukisto.internal.languages.bulgarian | ||
|
||
import pl.allegro.finance.tradukisto.internal.languages.AbstractIntegerValuesTest | ||
|
||
import static pl.allegro.finance.tradukisto.internal.Container.bulgarianContainer | ||
|
||
class BulgarianIntegerValuesTest extends AbstractIntegerValuesTest { | ||
|
||
def setup() { | ||
intConverter = bulgarianContainer().getIntegerConverter() | ||
} | ||
|
||
@Override | ||
IntegerValuesTestData getTestData() { | ||
testData = new IntegerValuesTestData(integerTranslations) | ||
} | ||
|
||
private static integerTranslations = [ | ||
0 : "нула", | ||
1 : "един", | ||
2 : "два", | ||
3 : "три", | ||
4 : "четири", | ||
5 : "пет", | ||
6 : "шест", | ||
7 : "седем", | ||
8 : "осем", | ||
9 : "девет", | ||
|
||
11 : "единадесет", | ||
12 : "дванадесет", | ||
13 : "тринадесет", | ||
14 : "четиринадесет", | ||
15 : "петнадесет", | ||
16 : "шестнадесет", | ||
17 : "седемнадесет", | ||
18 : "осемнадесет", | ||
19 : "деветнадесет", | ||
|
||
10 : "десет", | ||
20 : "двадесет", | ||
30 : "тридесет", | ||
40 : "четиридесет", | ||
50 : "петдесет", | ||
60 : "шестдесет", | ||
70 : "седемдесет", | ||
80 : "осемдесет", | ||
90 : "деветдесет", | ||
|
||
21 : "двадесет един", | ||
37 : "тридесет седем", | ||
43 : "четиридесет три", | ||
58 : "петдесет осем", | ||
69 : "шестдесет девет", | ||
76 : "седемдесет шест", | ||
82 : "осемдесет два", | ||
95 : "деветдесет пет", | ||
|
||
100 : "сто", | ||
200 : "двеста", | ||
300 : "триста", | ||
400 : "четиристотин", | ||
500 : "петстотин", | ||
600 : "шестстотин", | ||
700 : "седемстотин", | ||
800 : "осемстотин", | ||
900 : "деветстотин", | ||
|
||
111 : "сто единадесет", | ||
272 : "двеста седемдесет два", | ||
387 : "триста осемдесет седем", | ||
448 : "четиристотин четиридесет осем", | ||
569 : "петстотин шестдесет девет", | ||
625 : "шестстотин двадесет пет", | ||
782 : "седемстотин осемдесет два", | ||
895 : "осемстотин деветдесет пет", | ||
999 : "деветстотин деветдесет девет", | ||
|
||
1_000 : "хиляда", | ||
2_000 : "две хиляди", | ||
3_000 : "три хиляди", | ||
4_000 : "четири хиляди", | ||
5_000 : "пет хиляди", | ||
7_634 : "седем хиляди шестстотин тридесет четири", | ||
11_000 : "единадесет хиляди", | ||
15_000 : "петнадесет хиляди", | ||
21_000 : "двадесет една хиляди", | ||
24_190 : "двадесет четири хиляди сто деветдесет", | ||
653_000 : "шестстотин петдесет три хиляди", | ||
123_454 : "сто двадесет три хиляди четиристотин петдесет четири", | ||
700_000 : "седемстотин хиляди", | ||
999_999 : "деветстотин деветдесет девет хиляди деветстотин деветдесет девет", | ||
|
||
1_000_000 : "един милион", | ||
2_000_000 : "два милиона", | ||
5_000_000 : "пет милиона", | ||
23_437_219 : "двадесет три милиона четиристотин тридесет седем хиляди двеста деветнадесет", | ||
100_000_000 : "сто милиона", | ||
121_000_000 : "сто двадесет един милион", | ||
123_456_789 : "сто двадесет три милиона четиристотин петдесет шест хиляди седемстотин осемдесет девет", | ||
322_089_890 : "триста двадесет два милиона осемдесет девет хиляди осемстотин деветдесет", | ||
|
||
1_000_000_000: "един милиард", | ||
2_147_483_647: "два милиарда сто четиридесет седем милиона четиристотин осемдесет три хиляди шестстотин четиридесет седем" | ||
] | ||
} |
131 changes: 0 additions & 131 deletions
131
...ovy/pl/allegro/finance/tradukisto/internal/languages/bulgarian/BulgarianValuesTest.groovy
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.