FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
test_common_ui.php
Go to the documentation of this file.
1 <?php
2 /*
3 Copyright (C) 2014, Siemens AG
4 Author: Steffen Weber
5 
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 version 2 as published by the Free Software Foundation.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19 
25 require_once(dirname(__FILE__) . '/../common-ui.php');
26 
30 class test_common_ui extends \PHPUnit\Framework\TestCase
31 {
32  /* initialization */
33  protected function setUp()
34  {
35  //print "Starting unit test for common-ui.php\n";
36  print('.');
37  }
38 
42  protected function tearDown()
43  {
44  print "Ending unit test for common-ui.php\n";
45  }
46 
50  function test_HumanSize()
51  {
52  print "test function HumanSize()\n";
53  $result = HumanSize(1024 * 1024 * 1024);
54  $this->assertEquals("1 GB", $result);
55  $result = HumanSize(10240);
56  $this->assertEquals("10 KB", $result);
57  $result = HumanSize(1024 * (1024 * 99 + 511));
58  $this->assertEquals("99.5 MB", $result);
59  }
60 }
test_HumanSize()
test for HumanSize
tearDown()
clean the env
HumanSize($bytes)
Translate a byte number to a proper type, xxx bytes to xxx B/KB/MB/GB/TB/PB.
Definition: common-ui.php:109