@@ -5,42 +5,37 @@ void main() {
5
5
group ('DecimalSeparatorFormat >' , () {
6
6
group ('Exceptions >' , () {
7
7
test ('empty' , () {
8
- String actual () => RankFormat .none .format ('' );
8
+ String actual () => DecimalSeparatorFormat .point .format ('' );
9
9
final expected = throwsA (const TypeMatcher <ArgumentError >());
10
10
expect (actual, expected);
11
11
});
12
12
test ('comma separated' , () {
13
- String actual () => RankFormat .none .format ('1234,5' );
13
+ String actual () => DecimalSeparatorFormat .point .format ('1234,5' );
14
14
final expected = throwsA (const TypeMatcher <ArgumentError >());
15
15
expect (actual, expected);
16
16
});
17
17
test ('comma separated with too much fractionals' , () {
18
- String actual () => RankFormat .none .format ('1234,567' );
18
+ String actual () => DecimalSeparatorFormat .point .format ('1234,567' );
19
19
final expected = throwsA (const TypeMatcher <ArgumentError >());
20
20
expect (actual, expected);
21
21
});
22
22
test ('integer with decimal point' , () {
23
- String actual () => RankFormat .none .format ('123.' );
23
+ String actual () => DecimalSeparatorFormat .point .format ('123.' );
24
24
final expected = throwsA (const TypeMatcher <ArgumentError >());
25
25
expect (actual, expected);
26
26
});
27
27
test ('decimal point' , () {
28
- String actual () => RankFormat .none .format ('.' );
28
+ String actual () => DecimalSeparatorFormat .point .format ('.' );
29
29
final expected = throwsA (const TypeMatcher <ArgumentError >());
30
30
expect (actual, expected);
31
31
});
32
32
test ('decimal point and fractionals' , () {
33
- String actual () => RankFormat .none .format ('.23' );
33
+ String actual () => DecimalSeparatorFormat .point .format ('.23' );
34
34
final expected = throwsA (const TypeMatcher <ArgumentError >());
35
35
expect (actual, expected);
36
36
});
37
37
test ('decimal point and too much fractionals' , () {
38
- String actual () => RankFormat .none.format ('.234' );
39
- final expected = throwsA (const TypeMatcher <ArgumentError >());
40
- expect (actual, expected);
41
- });
42
- test ('too much fractionals' , () {
43
- String actual () => RankFormat .none.format ('1.234' );
38
+ String actual () => DecimalSeparatorFormat .point.format ('.234' );
44
39
final expected = throwsA (const TypeMatcher <ArgumentError >());
45
40
expect (actual, expected);
46
41
});
@@ -150,11 +145,6 @@ void main() {
150
145
final expected = throwsA (const TypeMatcher <ArgumentError >());
151
146
expect (actual, expected);
152
147
});
153
- test ('too much fractionals' , () {
154
- String actual () => RankFormat .none.format ('1.234' );
155
- final expected = throwsA (const TypeMatcher <ArgumentError >());
156
- expect (actual, expected);
157
- });
158
148
});
159
149
160
150
group ('None >' , () {
@@ -236,6 +226,11 @@ void main() {
236
226
const expected = '12345678.85' ;
237
227
expect (actual, expected);
238
228
});
229
+ test ('1234.857562' , () {
230
+ final actual = RankFormat .none.format ('1234.857562' );
231
+ const expected = '1234.857562' ;
232
+ expect (actual, expected);
233
+ });
239
234
});
240
235
});
241
236
@@ -318,6 +313,11 @@ void main() {
318
313
const expected = '12 345 678.85' ;
319
314
expect (actual, expected);
320
315
});
316
+ test ('1234.857562' , () {
317
+ final actual = RankFormat .space.format ('1234.857562' );
318
+ const expected = '1 234.857562' ;
319
+ expect (actual, expected);
320
+ });
321
321
});
322
322
});
323
323
});
@@ -342,6 +342,12 @@ void main() {
342
342
const expected = '1234' ;
343
343
expect (actual, expected);
344
344
});
345
+ test ('1234.56789, precision 4' , () {
346
+ final actual = MoneyFormat .integer.format (
347
+ Money .fromDouble (1234.56789 , FiatCurrency .$default, precision: 4 ));
348
+ const expected = '1234' ;
349
+ expect (actual, expected);
350
+ });
345
351
});
346
352
347
353
group ('fixedDouble >' , () {
@@ -363,6 +369,12 @@ void main() {
363
369
const expected = '1234.56' ;
364
370
expect (actual, expected);
365
371
});
372
+ test ('1234.56789, precision 4' , () {
373
+ final actual = MoneyFormat .fixedDouble.format (
374
+ Money .fromDouble (1234.56789 , FiatCurrency .$default, precision: 4 ));
375
+ const expected = '1234.5679' ;
376
+ expect (actual, expected);
377
+ });
366
378
});
367
379
368
380
group ('flexibleDouble >' , () {
@@ -384,6 +396,12 @@ void main() {
384
396
const expected = '1234.56' ;
385
397
expect (actual, expected);
386
398
});
399
+ test ('1234.567, precision 4' , () {
400
+ final actual = MoneyFormat .flexibleDouble.format (
401
+ Money .fromDouble (1234.567 , FiatCurrency .$default, precision: 4 ));
402
+ const expected = '1234.567' ;
403
+ expect (actual, expected);
404
+ });
387
405
});
388
406
});
389
407
0 commit comments