Exemple #1
0
function add_si_unit($number)
{
    return CommonFunctions::formatSiUnitPrefix($number);
}
 /**
  * Test method for formatSiUnitPrefix()
  */
 public function testFormatSiUnitPrefix()
 {
     // No Unit prefix
     $this->assertEquals("100", CommonFunctions::formatSiUnitPrefix(100), CommonFunctions::formatSiUnitPrefix(100));
     $this->assertEquals(152, CommonFunctions::formatSiUnitPrefix(152));
     $this->assertEquals(94, CommonFunctions::formatSiUnitPrefix(94));
     // kilo
     $this->assertEquals("1 k", CommonFunctions::formatSiUnitPrefix(1000));
     $this->assertEquals("1.52 k", CommonFunctions::formatSiUnitPrefix(1520));
     $this->assertEquals("1.52 k", CommonFunctions::formatSiUnitPrefix(1523));
     // Mega
     $this->assertEquals("1 M", CommonFunctions::formatSiUnitPrefix(1000000));
     $this->assertEquals("1.53 M", CommonFunctions::formatSiUnitPrefix(1530000));
     $this->assertEquals("1.53 M", CommonFunctions::formatSiUnitPrefix(1525000));
     $this->assertEquals("1.54 M", CommonFunctions::formatSiUnitPrefix(1536750));
     // Giga
     $this->assertEquals("1 G", CommonFunctions::formatSiUnitPrefix(1000000000));
     $this->assertEquals("1.93 G", CommonFunctions::formatSiUnitPrefix(1930000000));
     $this->assertEquals("1.54 G", CommonFunctions::formatSiUnitPrefix(1542000000));
     $this->assertEquals("1.55 G", CommonFunctions::formatSiUnitPrefix(1546000000));
     //Tera
     $this->assertEquals("1 T", CommonFunctions::formatSiUnitPrefix(1000000000000));
     $this->assertEquals("1.45 T", CommonFunctions::formatSiUnitPrefix(1450000000000));
     $this->assertEquals("1.52 T", CommonFunctions::formatSiUnitPrefix(1523000000000));
     $this->assertEquals("1.53 T", CommonFunctions::formatSiUnitPrefix(1525000000000));
 }
            <td><a href="#" title="<?php 
            echo $rset[$c][2];
            ?>
" onmousedown="viewAttach('<?php 
            echo $rset[$c][1];
            ?>
')" ><?php 
            echo $rset[$c][3];
            ?>
</a></td>
            <td><?php 
            echo $rset[$c][2];
            ?>
</td>
            <td><?php 
            echo CommonFunctions::formatSiUnitPrefix($rset[$c][4]);
            ?>
B</td>
            <td><?php 
            echo $rset[$c][6];
            ?>
</td>
        </tr>
<?php 
        }
        ?>
			</tbody>
          </table>
<?php 
    } else {
        if (!$locRights['add']) {