<?php/********************************************************************************************
* BlueShoes Framework; This file is part of the php application framework.
* NOTE: This code is stripped (obfuscated). To get the clean documented code goto 
*       www.blueshoes.org and register for the free open source *DEVELOPER* version or 
*       buy the commercial version.
*       
*       In case you've already got the developer version, then this is one of the few 
*       packages/classes that is only available to *PAYING* customers.
*       To get it go to www.blueshoes.org and buy a commercial version.
* 
* @copyright www.blueshoes.org
* @author    Samuel Blume <sam at blueshoes dot org>
* @author    Andrej Arn <andrej at blueshoes dot org>
*/?><?php
require_once($APP['path']['core'] . 'util/Bs_UnitConverter.class.php');class Bs_UnitConverter_PhpUnit extends Bs_TestCase {var $_Bs_UnitConverter;function Bs_UnitConverter_PhpUnit($name) {$this->Bs_TestCase($name);$this->_Bs_UnitConverter =& new Bs_UnitConverter;}
function __Bs_UnitConverter_bitsAndBytes() {$expected = '1024';$actual = $this->_Bs_UnitConverter->bitsAndBytes('megabytes', 'kilobytes', 1);$this->assertEquals($expected, $actual, "");$expected = '0.0009765625';$actual = $this->_Bs_UnitConverter->bitsAndBytes('bits', 'kilobits', 1, 10);$this->assertEquals($expected, $actual, "");}
function __Bs_UnitConverter_temperature() {$expected = '68';$actual = $this->_Bs_UnitConverter->temperature('celsius', 'fahrenheit', 20);$this->assertEquals($expected, $actual, "20 celsius - fahrenheit");$expected = '-6.66667';$precision = 5;$actual = $this->_Bs_UnitConverter->temperature('fahrenheit', 'celsius', 20, $precision);$this->assertEquals($expected, $actual, "20 fahrenheit - celsius");$expected = '479.67';$actual = $this->_Bs_UnitConverter->temperature('fahrenheit', 'rankine', 20);$this->assertEquals($expected, $actual, "20 fahrenheit - rankine");}
function __Bs_UnitConverter_length() {$expected = '182.88';$actual = $this->_Bs_UnitConverter->length('cables', 'm', 1);$this->assertEquals($expected, $actual, "1 cables - meters");$expected = '0.01';$actual = $this->_Bs_UnitConverter->length('cm', 'm', 1);$this->assertEquals($expected, $actual, "1 cm - meters");$expected = '20.1168';$precision = 4;$actual = $this->_Bs_UnitConverter->length('chains', 'm', 1, $precision);$this->assertEquals($expected, $actual, "1 chains - meters");$expected = '0.1';$actual = $this->_Bs_UnitConverter->length('dm', 'm', 1);$this->assertEquals($expected, $actual, "1 dm - meters");$expected = '0.875';$actual = $this->_Bs_UnitConverter->length('ells', 'm', 1);$this->assertEquals($expected, $actual, "1 ells - meters");$expected = '1.83';$precision = 2;$actual = $this->_Bs_UnitConverter->length('fathoms', 'm', 1, $precision);$this->assertEquals($expected, $actual, "1 fathoms - meters");$expected = '0.3048';$precision = 4;$actual = $this->_Bs_UnitConverter->length('feet', 'm', 1, $precision);$this->assertEquals($expected, $actual, "1 feet - meters");$expected = '201.168';$actual = $this->_Bs_UnitConverter->length('furlongs', 'm', 1);$this->assertEquals($expected, $actual, "1 furlongs - meters");$expected = '0.106';$actual = $this->_Bs_UnitConverter->length('hands', 'm', 1);$this->assertEquals($expected, $actual, "1 hands - meters");$expected = '100';$actual = $this->_Bs_UnitConverter->length('hm', 'm', 1);$this->assertEquals($expected, $actual, "1 hm - meters");$expected = '0.0254';$precision = 4;$actual = $this->_Bs_UnitConverter->length('inches', 'm', 1, $precision);$this->assertEquals($expected, $actual, "1 inches - meters");$expected = '1000';$actual = $this->_Bs_UnitConverter->length('km', 'm', 1);$this->assertEquals($expected, $actual, "1 km - meters");$expected = '1.1428571429';$precision = 10;$actual = $this->_Bs_UnitConverter->length('m', 'ells', 1, $precision);$this->assertEquals($expected, $actual, "1 m - ells");$expected = '1609.344';$actual = $this->_Bs_UnitConverter->length('miles', 'm', 1);$this->assertEquals($expected, $actual, "1 miles - meters");$expected = '1852';$actual = $this->_Bs_UnitConverter->length('milesNautical', 'm', 1);$this->assertEquals($expected, $actual, "1 milesNautical - meters");$expected = '0.001';$actual = $this->_Bs_UnitConverter->length('mm', 'm', 1);$this->assertEquals($expected, $actual, "1 mm - meters");$expected = '0.914';$actual = $this->_Bs_UnitConverter->length('yards', 'm', 1);$this->assertEquals($expected, $actual, "1 yards - meters");}
}
?>