@@ -101,7 +101,7 @@ public function test_validate_success($value, $min, $max, $decpoint = '.')
101
101
public function valueProvider ()
102
102
{
103
103
return array (
104
- // $value, $expect, $roundto, $decpoint, $thousands, $trimzeros, $prefix='', $postfix=''
104
+ // $value, $expect, $roundto, $decpoint, $thousands, $trimzeros, $prefix='', $postfix='', $engineering = false
105
105
array ('5000 ' , '5 000,00 ' , '2 ' , ', ' , ' ' , false ),
106
106
array ('5000 ' , '5 000 ' , '2 ' , ', ' , ' ' , true ),
107
107
array ('5000 ' , '5 000 ' , '0 ' , ', ' , ' ' , false ),
@@ -117,21 +117,46 @@ public function valueProvider()
117
117
118
118
array ('-0.55600 ' , '$ -0,556 ' , '4 ' , ', ' , ' ' , true , '$ ' ),
119
119
array ('-0.55600 ' , '-0,556 EUR ' , '4 ' , ', ' , ' ' , true , '' , ' EUR ' ),
120
+
121
+ //engineering notation
122
+ array ('1e-18 ' , '1 ' ."\xE2\x80\xAF" .'a ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
123
+ array ('1e-15 ' , '1 ' ."\xE2\x80\xAF" .'f ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
124
+ array ('1e-12 ' , '1 ' ."\xE2\x80\xAF" .'p ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
125
+ array ('1e-9 ' , '1 ' ."\xE2\x80\xAF" .'n ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
126
+ array ('1e-6 ' , '1 ' ."\xE2\x80\xAF" .'µ ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
127
+ array ('1e-3 ' , '1 ' ."\xE2\x80\xAF" .'m ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
128
+
129
+ array ('1e3 ' , '1 ' ."\xE2\x80\xAF" .'k ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
130
+ array ('1e6 ' , '1 ' ."\xE2\x80\xAF" .'M ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
131
+ array ('1e9 ' , '1 ' ."\xE2\x80\xAF" .'G ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
132
+ array ('1e12 ' , '1 ' ."\xE2\x80\xAF" .'T ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
133
+
134
+ array ('1e4 ' , '10 ' . "\xE2\x80\xAF" .'k ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
135
+ array ('1e5 ' , '100 ' ."\xE2\x80\xAF" .'k ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
136
+
137
+ array ('1e-4 ' , '100 ' ."\xE2\x80\xAF" .'µ ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
138
+ array ('1e-5 ' , '10 ' . "\xE2\x80\xAF" .'µ ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
139
+
140
+ //test behaviour if number exceeds prefix array
141
+ array ('1e15 ' , '1000 ' . "\xE2\x80\xAF" .'T ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
142
+ array ('1e-21 ' , '0.001 ' ."\xE2\x80\xAF" .'a ' , '-1 ' , ', ' , ' ' , true , '' , '' , true ),
143
+
120
144
);
121
145
}
122
146
123
147
/**
124
148
* @dataProvider valueProvider
125
149
*/
126
- public function test_renderValue ($ value , $ expect , $ roundto , $ decpoint , $ thousands , $ trimzeros , $ prefix = '' , $ postfix = '' )
150
+ public function test_renderValue ($ value , $ expect , $ roundto , $ decpoint , $ thousands , $ trimzeros , $ prefix = '' , $ postfix = '' , $ engineering = false )
127
151
{
128
152
$ decimal = new Decimal (array (
129
153
'roundto ' => $ roundto ,
130
154
'decpoint ' => $ decpoint ,
131
155
'thousands ' => $ thousands ,
132
156
'trimzeros ' => $ trimzeros ,
133
157
'prefix ' => $ prefix ,
134
- 'postfix ' => $ postfix
158
+ 'postfix ' => $ postfix ,
159
+ 'engineering ' => $ engineering
135
160
));
136
161
$ R = new \Doku_Renderer_xhtml ();
137
162
$ R ->doc = '' ;
0 commit comments