spell_number 0.0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +42 -0
- data/Gemfile +5 -13
- data/Gemfile.lock +32 -23
- data/LICENSE.txt +203 -18
- data/Rakefile +2 -50
- data/bin/console +14 -0
- data/spec/number_to_spell_de_spec.rb +76 -77
- data/spec/number_to_spell_spec.rb +91 -92
- data/spec/spec_helper.rb +1 -0
- data/spell_number.gemspec +17 -65
- metadata +76 -114
@@ -1,91 +1,90 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "spell numbers in german" do
|
4
|
-
|
3
|
+
describe "spell numbers in german" do
|
5
4
|
def test_number(number, result)
|
6
|
-
SpellNumber.number_to_words(number, :
|
5
|
+
expect(SpellNumber.number_to_words(number, locale: 'de')).to eq result
|
7
6
|
end
|
8
|
-
|
7
|
+
|
9
8
|
describe "Single digits" do
|
10
9
|
it "should transform 1" do
|
11
10
|
test_number(1, 'eins')
|
12
11
|
end
|
13
|
-
|
12
|
+
|
14
13
|
it "should transform 2" do
|
15
14
|
test_number(2, 'zwei')
|
16
15
|
end
|
17
|
-
|
16
|
+
|
18
17
|
it "should transform 3" do
|
19
18
|
test_number(3, 'drei')
|
20
19
|
end
|
21
|
-
|
20
|
+
|
22
21
|
it "should transform 4" do
|
23
22
|
test_number(4, 'vier')
|
24
23
|
end
|
25
|
-
|
24
|
+
|
26
25
|
it "should transform 5" do
|
27
26
|
test_number(5, 'fünf')
|
28
27
|
end
|
29
|
-
|
28
|
+
|
30
29
|
it "should transform 6" do
|
31
30
|
test_number(6, 'sechs')
|
32
31
|
end
|
33
|
-
|
32
|
+
|
34
33
|
it "should transform 7" do
|
35
34
|
test_number(7, 'sieben')
|
36
35
|
end
|
37
|
-
|
36
|
+
|
38
37
|
it "should transform 8" do
|
39
38
|
test_number(8, 'acht')
|
40
39
|
end
|
41
|
-
|
40
|
+
|
42
41
|
it "should transform 9" do
|
43
42
|
test_number(9, 'neun')
|
44
43
|
end
|
45
|
-
|
44
|
+
|
46
45
|
it "should transform 10" do
|
47
46
|
test_number(0, 'null')
|
48
47
|
end
|
49
48
|
end
|
50
|
-
|
51
|
-
describe "Teens" do
|
52
|
-
|
49
|
+
|
50
|
+
describe "Teens" do
|
51
|
+
|
53
52
|
it "should spell 10 as zehn" do
|
54
53
|
test_number(10, 'zehn')
|
55
54
|
end
|
56
|
-
|
55
|
+
|
57
56
|
it "should spell 11 as elf" do
|
58
57
|
test_number(11, 'elf')
|
59
58
|
end
|
60
|
-
|
59
|
+
|
61
60
|
it "should spell 12 as zwölf" do
|
62
61
|
test_number(12, 'zwölf')
|
63
62
|
end
|
64
|
-
|
63
|
+
|
65
64
|
it "should spell 13 as dreizehn" do
|
66
65
|
test_number(13, 'dreizehn')
|
67
66
|
end
|
68
|
-
|
67
|
+
|
69
68
|
it "should spell 14 as vierzehn" do
|
70
69
|
test_number(14, 'vierzehn')
|
71
70
|
end
|
72
|
-
|
71
|
+
|
73
72
|
it "should spell 15 as fünfzehn" do
|
74
73
|
test_number(15, 'fünfzehn')
|
75
74
|
end
|
76
|
-
|
75
|
+
|
77
76
|
it "should spell 16 as sechzehn" do
|
78
77
|
test_number(16, 'sechzehn')
|
79
78
|
end
|
80
|
-
|
79
|
+
|
81
80
|
it "should spell 17 as siebzehn" do
|
82
81
|
test_number(17, 'siebzehn')
|
83
82
|
end
|
84
|
-
|
83
|
+
|
85
84
|
it "should spell 18 as achtzehn" do
|
86
85
|
test_number(18, 'achtzehn')
|
87
86
|
end
|
88
|
-
|
87
|
+
|
89
88
|
it "should spell 19 as neunzehn" do
|
90
89
|
test_number(19, 'neunzehn')
|
91
90
|
end
|
@@ -134,171 +133,171 @@ describe "spell numbers in german" do
|
|
134
133
|
end
|
135
134
|
end
|
136
135
|
|
137
|
-
describe "Thirties" do
|
136
|
+
describe "Thirties" do
|
138
137
|
it "should spell 30 as dreissig" do
|
139
138
|
test_number(30, 'dreissig')
|
140
139
|
end
|
141
|
-
|
140
|
+
|
142
141
|
it "should spell 33 as dreiundreissig" do
|
143
142
|
test_number(33, 'dreiunddreissig')
|
144
|
-
end
|
143
|
+
end
|
145
144
|
end
|
146
|
-
|
147
|
-
describe "Fourties" do
|
145
|
+
|
146
|
+
describe "Fourties" do
|
148
147
|
it "should spell 40 as vierzig" do
|
149
148
|
test_number(40, 'vierzig')
|
150
149
|
end
|
151
|
-
|
150
|
+
|
152
151
|
it "should spell 44 as vierundvierzig" do
|
153
152
|
test_number(44, 'vierundvierzig')
|
154
|
-
end
|
153
|
+
end
|
155
154
|
end
|
156
|
-
|
157
|
-
describe "Fifties" do
|
155
|
+
|
156
|
+
describe "Fifties" do
|
158
157
|
it "should spell 50 as fünfzig" do
|
159
158
|
test_number(50, 'fünfzig')
|
160
159
|
end
|
161
|
-
|
160
|
+
|
162
161
|
it "should spell 55 as fünfundfünfzig" do
|
163
162
|
test_number(55, 'fünfundfünfzig')
|
164
|
-
end
|
163
|
+
end
|
165
164
|
end
|
166
|
-
|
167
|
-
describe "Sixties" do
|
165
|
+
|
166
|
+
describe "Sixties" do
|
168
167
|
it "should spell 60 as sechzig" do
|
169
168
|
test_number(60, 'sechzig')
|
170
169
|
end
|
171
|
-
|
170
|
+
|
172
171
|
it "should spell 66 as sechsundsechzig" do
|
173
172
|
test_number(66, 'sechsundsechzig')
|
174
|
-
end
|
173
|
+
end
|
175
174
|
end
|
176
|
-
|
177
|
-
describe "Seventies" do
|
175
|
+
|
176
|
+
describe "Seventies" do
|
178
177
|
it "should spell 70 as siebzig" do
|
179
178
|
test_number(70, 'siebzig')
|
180
179
|
end
|
181
|
-
|
180
|
+
|
182
181
|
it "should spell 77 as siebenundsiebzig" do
|
183
182
|
test_number(77, 'siebenundsiebzig')
|
184
|
-
end
|
183
|
+
end
|
185
184
|
end
|
186
|
-
|
187
|
-
describe "Eighties" do
|
185
|
+
|
186
|
+
describe "Eighties" do
|
188
187
|
it "should spell 80 as achtzig" do
|
189
188
|
test_number(80, 'achtzig')
|
190
189
|
end
|
191
|
-
|
190
|
+
|
192
191
|
it "should spell 88 as achtundachtzig" do
|
193
192
|
test_number(88, 'achtundachtzig')
|
194
|
-
end
|
193
|
+
end
|
195
194
|
end
|
196
|
-
|
197
|
-
describe "Nineties" do
|
195
|
+
|
196
|
+
describe "Nineties" do
|
198
197
|
it "should spell 90 as neunzig" do
|
199
198
|
test_number(90, 'neunzig')
|
200
199
|
end
|
201
|
-
|
200
|
+
|
202
201
|
it "should spell 99 as neunundneunzig" do
|
203
202
|
test_number(99, 'neunundneunzig')
|
204
|
-
end
|
203
|
+
end
|
205
204
|
end
|
206
205
|
|
207
|
-
|
206
|
+
|
208
207
|
describe "Hundreds" do
|
209
208
|
it "should spell 100 as einhundert" do
|
210
209
|
test_number(100, 'einhundert')
|
211
210
|
end
|
212
|
-
|
211
|
+
|
213
212
|
it "should spell 101 as einhundertundeins" do
|
214
213
|
test_number(101, 'einhunderteins')
|
215
214
|
end
|
216
|
-
|
215
|
+
|
217
216
|
it "should spell 111 as einhundertundelf" do
|
218
217
|
test_number(111, 'einhundertelf')
|
219
218
|
end
|
220
|
-
|
219
|
+
|
221
220
|
it "should spell 155 as einhundertundfünfundfünfzig" do
|
222
221
|
test_number(155, 'einhundertfünfundfünfzig')
|
223
222
|
end
|
224
|
-
|
223
|
+
|
225
224
|
it "should spell 190 as einhundertneunzig" do
|
226
225
|
test_number(190, 'einhundertneunzig')
|
227
226
|
end
|
228
|
-
|
227
|
+
|
229
228
|
it "should spell 200 as zweihundert" do
|
230
229
|
test_number(200, 'zweihundert')
|
231
230
|
end
|
232
|
-
|
231
|
+
|
233
232
|
it "should spell 222 as zweihundertzeiundzwanzig" do
|
234
233
|
test_number(222, 'zweihundertzweiundzwanzig')
|
235
234
|
end
|
236
|
-
|
235
|
+
|
237
236
|
it "should spell 999 as neunhundertneunundneunzig" do
|
238
237
|
test_number(999, 'neunhundertneunundneunzig')
|
239
238
|
end
|
240
239
|
end
|
241
240
|
|
242
241
|
describe "Thousands" do
|
243
|
-
|
242
|
+
|
244
243
|
it "should spell 1000 as eintausend" do
|
245
244
|
test_number(1000, 'eintausend')
|
246
245
|
end
|
247
|
-
|
246
|
+
|
248
247
|
it "should spell 1001 as eintausendeins" do
|
249
248
|
test_number(1001, 'eintausendeins')
|
250
249
|
end
|
251
|
-
|
250
|
+
|
252
251
|
it "should spell 1011 as eintausendelf" do
|
253
252
|
test_number(1011, 'eintausendelf')
|
254
253
|
end
|
255
|
-
|
254
|
+
|
256
255
|
it "should spell 1100 as eintausendeinhundert" do
|
257
256
|
test_number(1100, 'eintausendeinhundert')
|
258
257
|
end
|
259
|
-
|
258
|
+
|
260
259
|
it "should spell 1111 as eintausendeinhundertelf" do
|
261
260
|
test_number(1111, 'eintausendeinhundertelf')
|
262
261
|
end
|
263
|
-
|
262
|
+
|
264
263
|
it "should spell 999,999 as neunhundertneunundneunzigtausendneunhundertneunundneunzig" do
|
265
264
|
test_number(999999, 'neunhundertneunundneunzigtausendneunhundertneunundneunzig')
|
266
265
|
end
|
267
|
-
|
266
|
+
|
268
267
|
end
|
269
268
|
|
270
269
|
|
271
270
|
describe "Millions" do
|
272
|
-
|
271
|
+
|
273
272
|
it "should spell 1.000.000 as eine Million" do
|
274
273
|
test_number(1000000, 'eine Million')
|
275
274
|
end
|
276
|
-
|
275
|
+
|
277
276
|
it "should spell 1.000.001 as eine Million und eins" do
|
278
277
|
test_number(1000001, 'eine Million und eins')
|
279
278
|
end
|
280
|
-
|
279
|
+
|
281
280
|
it "should spell 1.000.011 as eine Million und elf" do
|
282
281
|
test_number(1000011, 'eine Million und elf')
|
283
282
|
end
|
284
|
-
|
283
|
+
|
285
284
|
it "should spell 1.000.100 as eine Million und einhundert" do
|
286
285
|
test_number(1000100, 'eine Million und einhundert')
|
287
286
|
end
|
288
|
-
|
287
|
+
|
289
288
|
it "should spell 1.000.111 as eine Million und einhundertelf" do
|
290
289
|
test_number(1000111, 'eine Million und einhundertelf')
|
291
290
|
end
|
292
|
-
|
291
|
+
|
293
292
|
it "should spell 1.001.111 as eine Million und eintausendeinhundertelf" do
|
294
293
|
test_number(1001111, 'eine Million und eintausendeinhundertelf')
|
295
294
|
end
|
296
|
-
|
295
|
+
|
297
296
|
it "should spell 999.999.999.999 as neunhundertneunundneunzigtausendneunundneunzig Millionen und neunhundertneunundneunzigtausendneunundneunzig" do
|
298
297
|
test_number(999999999999, 'neunhundertneunundneunzigtausendneunhundertneunundneunzig Millionen und neunhundertneunundneunzigtausendneunhundertneunundneunzig')
|
299
298
|
end
|
300
|
-
|
299
|
+
|
301
300
|
end
|
302
301
|
|
303
302
|
|
304
|
-
end
|
303
|
+
end
|