@@ -30,45 +30,39 @@ void main() {
30
30
expect (formatWithSuffix (1234000 ), '1.2m' );
31
31
});
32
32
33
- test ('Significant digit 0-999' , () {
34
- expect (formatWith3SignificantDigits (0 ), (value: '0' , suffix: '' ));
35
- expect (formatWith3SignificantDigits (1 ), (value: '1' , suffix: '' ));
36
- expect (formatWith3SignificantDigits (23 ), (value: '23' , suffix: '' ));
37
- expect (formatWith3SignificantDigits (999 ), (value: '999' , suffix: '' ));
33
+ test ('Compact format 0-999' , () {
34
+ expect (compactFormat (0 ), (value: '0' , suffix: '' ));
35
+ expect (compactFormat (1 ), (value: '1' , suffix: '' ));
36
+ expect (compactFormat (23 ), (value: '23' , suffix: '' ));
37
+ expect (compactFormat (999 ), (value: '999' , suffix: '' ));
38
38
});
39
39
40
- test ('Significant digit 1000-999499' , () {
41
- expect (formatWith3SignificantDigits (1000 ), (value: '1.00 ' , suffix: 'k' ));
42
- expect (formatWith3SignificantDigits (1049 ), (value: '1.05' , suffix: 'k' ));
43
- expect (formatWith3SignificantDigits (1051 ), (value: '1.05' , suffix: 'k' ));
44
- expect (formatWith3SignificantDigits (1100 ), (value: '1.10 ' , suffix: 'k' ));
45
- expect (formatWith3SignificantDigits (9500 ), (value: '9.50 ' , suffix: 'k' ));
46
- expect (formatWith3SignificantDigits (99500 ), (value: '99.5' , suffix: 'k' ));
47
- expect (formatWith3SignificantDigits (100490 ), (value: '100' , suffix: 'k' ));
48
- expect (formatWith3SignificantDigits (100500 ), (value: '101' , suffix: 'k' ));
49
- expect (formatWith3SignificantDigits (199500 ), (value: '200' , suffix: 'k' ));
50
- expect (formatWith3SignificantDigits (999499 ), (value: '999' , suffix: 'k' ));
40
+ test ('Compact format 1000-999499' , () {
41
+ expect (compactFormat (1000 ), (value: '1' , suffix: 'k' ));
42
+ expect (compactFormat (1049 ), (value: '1.05' , suffix: 'k' ));
43
+ expect (compactFormat (1051 ), (value: '1.05' , suffix: 'k' ));
44
+ expect (compactFormat (1100 ), (value: '1.1 ' , suffix: 'k' ));
45
+ expect (compactFormat (9500 ), (value: '9.5 ' , suffix: 'k' ));
46
+ expect (compactFormat (99500 ), (value: '99.5' , suffix: 'k' ));
47
+ expect (compactFormat (100490 ), (value: '100' , suffix: 'k' ));
48
+ expect (compactFormat (100500 ), (value: '101' , suffix: 'k' ));
49
+ expect (compactFormat (199500 ), (value: '200' , suffix: 'k' ));
50
+ expect (compactFormat (999499 ), (value: '999' , suffix: 'k' ));
51
51
});
52
52
53
- test ('Significant digit 999500-100000000' , () {
54
- expect (formatWith3SignificantDigits (999500 ), (value: '1.00' , suffix: 'M' ));
55
- expect (formatWith3SignificantDigits (999999 ), (value: '1.00' , suffix: 'M' ));
56
- expect (
57
- formatWith3SignificantDigits (900000000 ), (value: '900' , suffix: 'M' ));
58
- expect (
59
- formatWith3SignificantDigits (999500000 ), (value: '1.00' , suffix: 'B' ));
60
- expect (
61
- formatWith3SignificantDigits (1009450000 ), (value: '1.01' , suffix: 'B' ));
62
- expect (
63
- formatWith3SignificantDigits (1094599999 ), (value: '1.09' , suffix: 'B' ));
64
- expect (
65
- formatWith3SignificantDigits (1095000001 ), (value: '1.10' , suffix: 'B' ));
66
- expect (formatWith3SignificantDigits (19000000000 ),
67
- (value: '19.0' , suffix: 'B' ));
53
+ test ('Compact format 999500-100000000' , () {
54
+ expect (compactFormat (999500 ), (value: '1' , suffix: 'M' ));
55
+ expect (compactFormat (999999 ), (value: '1' , suffix: 'M' ));
56
+ expect (compactFormat (900000000 ), (value: '900' , suffix: 'M' ));
57
+ expect (compactFormat (999500000 ), (value: '1' , suffix: 'B' ));
58
+ expect (compactFormat (1009450000 ), (value: '1.01' , suffix: 'B' ));
59
+ expect (compactFormat (1094599999 ), (value: '1.09' , suffix: 'B' ));
60
+ expect (compactFormat (1095000001 ), (value: '1.1' , suffix: 'B' ));
61
+ expect (compactFormat (19000000000 ), (value: '19' , suffix: 'B' ));
68
62
});
69
63
70
64
test ('Number with thousand seperators' , () {
71
- // expect(formatWithThousandSeperators(1), '1');
65
+ expect (formatWithThousandSeperators (1 ), '1' );
72
66
expect (formatWithThousandSeperators (10 ), '10' );
73
67
expect (formatWithThousandSeperators (100 ), '100' );
74
68
expect (formatWithThousandSeperators (1000 ), '1,000' );
0 commit comments