1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-31 19:30:21 +02:00

Improve floating point scaling in UnitConverter.

When precision dictates that a number be zero padded, we cannot give sprintf()
a negative precision specifier.  This commit implements manual negative precision
printing of floats, taking into account common rounding errors with floating
point numbers.

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
Edward Z. Yang
2008-10-24 12:50:59 -04:00
parent 25fa53c15b
commit 3a2fd0b5db
4 changed files with 38 additions and 3 deletions

View File

@@ -36,9 +36,10 @@ $AC = array(); // parameters
$AC['flush'] = false;
$AC['standalone'] = false;
$AC['file'] = '';
$AC['xml'] = false;
$AC['dry'] = false;
$AC['php'] = $php;
$AC['xml'] = false;
$AC['dry'] = false;
$AC['php'] = $php;
$AC['help'] = false;
$AC['type'] = '';
$AC['disable-phpt'] = false;
@@ -46,12 +47,28 @@ $AC['only-phpt'] = false; // alias for --type=phpt
$aliases = array(
'f' => 'file',
'h' => 'help'
);
// It's important that this does not call the autoloader. Not a problem
// with a function, but could be if we put this in a class.
htmlpurifier_parse_args($AC, $aliases);
if ($AC['help']) {
?>HTML Purifier test suite
Allowed options:
--flush
--standalone
--file (-f) HTMLPurifier/NameOfTest.php
--xml
--dry
--php /path/to/php
--type ( htmlpurifier | configdoc | fstools | htmlt | vtest | phpt )
--disable-phpt
<?php
exit;
}
// Disable PHPT tests if they're not enabled
if (!$GLOBALS['HTMLPurifierTest']['PHPT']) {
$AC['disable-phpt'] = true;