Skip to content

Commit 850c936

Browse files
committed
add eng not test
1 parent 51dec36 commit 850c936

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

_test/Type_Decimal.test.php

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function test_validate_success($value, $min, $max, $decpoint = '.')
101101
public function valueProvider()
102102
{
103103
return array(
104-
// $value, $expect, $roundto, $decpoint, $thousands, $trimzeros, $prefix='', $postfix=''
104+
// $value, $expect, $roundto, $decpoint, $thousands, $trimzeros, $prefix='', $postfix='', $engineering = false
105105
array('5000', '5 000,00', '2', ',', ' ', false),
106106
array('5000', '5 000', '2', ',', ' ', true),
107107
array('5000', '5 000', '0', ',', ' ', false),
@@ -117,21 +117,41 @@ public function valueProvider()
117117

118118
array('-0.55600', '$ -0,556', '4', ',', ' ', true, '$ '),
119119
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('1e15', '100'."\xE2\x80\xAF".'k', '-1', ',', ' ', true, '', '', true),
138+
120139
);
121140
}
122141

123142
/**
124143
* @dataProvider valueProvider
125144
*/
126-
public function test_renderValue($value, $expect, $roundto, $decpoint, $thousands, $trimzeros, $prefix = '', $postfix = '')
145+
public function test_renderValue($value, $expect, $roundto, $decpoint, $thousands, $trimzeros, $prefix = '', $postfix = '', $engineering = false)
127146
{
128147
$decimal = new Decimal(array(
129148
'roundto' => $roundto,
130149
'decpoint' => $decpoint,
131150
'thousands' => $thousands,
132151
'trimzeros' => $trimzeros,
133152
'prefix' => $prefix,
134-
'postfix' => $postfix
153+
'postfix' => $postfix,
154+
'engineering' => $engineering,
135155
));
136156
$R = new \Doku_Renderer_xhtml();
137157
$R->doc = '';

0 commit comments

Comments
 (0)