-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP * add base test class and helper trait * refactor a couple volume unit tests * add coverage annotations * declare used code for coverage reports * dynamic converter for incoming from unit * refactor tests to use generator data providers * add volume unit test suite * simplify test input * add time converter to tests * create time unit test suite * refactor provider test input to match new arguments * refactor tests for plane angle measurement units * just use `as` method to reduce boilerplate * change composer script syntax from `-` to `:` * remove redundancy in config * rename test for more clarity on meaning * refactor day tests * refactor hour tests * refactor microsecond tests * formatting * refactor millisecond tests * refactor minute tests * refactor month tests * refactor nanosecond tests * refactor seconds tests * refactor week tests * refactor year tests * refactor speed tests * refactor temperature tests * add formulae to convert Kelvin values * run fuel economy tests in volume suite * refactor frequency tests * try listing code use in parent test * list used code on each test itself * list code usage for tests * list code usage * refactor pressure tests * make coverage work again with new test structure * remove trait for now * refactor area tests * add energy units test suite * refactor calorie tests * refactor foot pound tests * refactor tests and update unit values * fix broken tests after merging master * fix energy tests * add length test suite * add default formula to all units * refactor, add, and correct all length tests – add forumla where needed * refactor all fuel economy volume tests * add mass test suite * refactor and add mass tests + add needed formulae * add digital storage test suite * refactor and add digital storage tests + needed formulae * add missing coverage statements * fix typo * add code coverage declarations * add missing code coverage usage annotation
- Loading branch information
1 parent
41bc3a7
commit 1523525
Showing
187 changed files
with
5,708 additions
and
3,004 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
|
||
/** | ||
* This file is part of the jordanbrauer/unit-converter PHP package. | ||
* | ||
* @copyright 2018 Jordan Brauer <[email protected]> | ||
* @license MIT | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace UnitConverter\Calculator\Formula\DigitalStorage\Gibibit; | ||
|
||
use UnitConverter\Calculator\Formula\AbstractFormula; | ||
|
||
/** | ||
* Formula to convert gibibit values to bits. | ||
* | ||
* @version 1.0.0 | ||
* @since 0.8.4 | ||
* @author Jordan Brauer <[email protected]> | ||
*/ | ||
final class ToBits extends AbstractFormula | ||
{ | ||
const FORMULA_STRING = 'b = Gib × 1.342e+8'; | ||
|
||
const FORMULA_TEMPLATE = '%b = %sGib × 1.342e+8'; | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function describe($value, $fromUnits, $toUnits, int $precision = null) | ||
{ | ||
$result = $this->calculator->mul($value, 1074000000); | ||
|
||
$this->plugVariables($result, $value); | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
|
||
/** | ||
* This file is part of the jordanbrauer/unit-converter PHP package. | ||
* | ||
* @copyright 2018 Jordan Brauer <[email protected]> | ||
* @license MIT | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace UnitConverter\Calculator\Formula\DigitalStorage\Gibibit; | ||
|
||
use UnitConverter\Calculator\Formula\AbstractFormula; | ||
|
||
/** | ||
* Formula to convert gibibit values to bytes. | ||
* | ||
* @version 1.0.0 | ||
* @since 0.8.4 | ||
* @author Jordan Brauer <[email protected]> | ||
*/ | ||
final class ToBytes extends AbstractFormula | ||
{ | ||
const FORMULA_STRING = 'B = Gib × 1.074e+9'; | ||
|
||
const FORMULA_TEMPLATE = '%B = %sGib × 1.074e+9'; | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function describe($value, $fromUnits, $toUnits, int $precision = null) | ||
{ | ||
$result = $this->calculator->mul($value, 134200000); | ||
|
||
$this->plugVariables($result, $value); | ||
|
||
return $result; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/Calculator/Formula/DigitalStorage/Gibibit/ToKibibits.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
|
||
/** | ||
* This file is part of the jordanbrauer/unit-converter PHP package. | ||
* | ||
* @copyright 2018 Jordan Brauer <[email protected]> | ||
* @license MIT | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace UnitConverter\Calculator\Formula\DigitalStorage\Gibibit; | ||
|
||
use UnitConverter\Calculator\Formula\AbstractFormula; | ||
|
||
/** | ||
* Formula to convert gibibit values to kibibits. | ||
* | ||
* @version 1.0.0 | ||
* @since 0.8.4 | ||
* @author Jordan Brauer <[email protected]> | ||
*/ | ||
final class ToKibibits extends AbstractFormula | ||
{ | ||
const FORMULA_STRING = 'Kib = Gib × 1.049e+6'; | ||
|
||
const FORMULA_TEMPLATE = '%Kib = %sGib × 1.049e+6'; | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function describe($value, $fromUnits, $toUnits, int $precision = null) | ||
{ | ||
$result = $this->calculator->mul($value, 1049000); | ||
|
||
$this->plugVariables($result, $value); | ||
|
||
return $result; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/Calculator/Formula/DigitalStorage/Gibibit/ToKilobits.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
|
||
/** | ||
* This file is part of the jordanbrauer/unit-converter PHP package. | ||
* | ||
* @copyright 2018 Jordan Brauer <[email protected]> | ||
* @license MIT | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace UnitConverter\Calculator\Formula\DigitalStorage\Gibibit; | ||
|
||
use UnitConverter\Calculator\Formula\AbstractFormula; | ||
|
||
/** | ||
* Formula to convert gibibit values to kilobits. | ||
* | ||
* @version 1.0.0 | ||
* @since 0.8.4 | ||
* @author Jordan Brauer <[email protected]> | ||
*/ | ||
final class ToKilobits extends AbstractFormula | ||
{ | ||
const FORMULA_STRING = 'kb = Gib × 1.074e+6'; | ||
|
||
const FORMULA_TEMPLATE = '%kb = %sGib × 1.074e+6'; | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function describe($value, $fromUnits, $toUnits, int $precision = null) | ||
{ | ||
$result = $this->calculator->mul($value, 1074000); | ||
|
||
$this->plugVariables($result, $value); | ||
|
||
return $result; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/Calculator/Formula/DigitalStorage/Gigabyte/ToKibibits.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
|
||
/** | ||
* This file is part of the jordanbrauer/unit-converter PHP package. | ||
* | ||
* @copyright 2018 Jordan Brauer <[email protected]> | ||
* @license MIT | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace UnitConverter\Calculator\Formula\DigitalStorage\Gigabyte; | ||
|
||
use UnitConverter\Calculator\Formula\AbstractFormula; | ||
|
||
/** | ||
* Formula to convert gigabyte values to kibibits. | ||
* | ||
* @version 1.0.0 | ||
* @since 0.8.4 | ||
* @author Jordan Brauer <[email protected]> | ||
*/ | ||
final class ToKibibits extends AbstractFormula | ||
{ | ||
const FORMULA_STRING = 'Kib = GB × 7.813e+6'; | ||
|
||
const FORMULA_TEMPLATE = '%Kib = %sGB × 7.813e+6'; | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function describe($value, $fromUnits, $toUnits, int $precision = null) | ||
{ | ||
$result = $this->calculator->mul($value, 7813000); | ||
|
||
$this->plugVariables($result, $value); | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
|
||
/** | ||
* This file is part of the jordanbrauer/unit-converter PHP package. | ||
* | ||
* @copyright 2018 Jordan Brauer <[email protected]> | ||
* @license MIT | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace UnitConverter\Calculator\Formula\DigitalStorage\Mebibit; | ||
|
||
use UnitConverter\Calculator\Formula\AbstractFormula; | ||
|
||
/** | ||
* Formula to convert mebibits values to bits. | ||
* | ||
* @version 1.0.0 | ||
* @since 0.8.4 | ||
* @author Jordan Brauer <[email protected]> | ||
*/ | ||
final class ToBits extends AbstractFormula | ||
{ | ||
const FORMULA_STRING = 'b = Mib × 1.049e+6'; | ||
|
||
const FORMULA_TEMPLATE = '%b = %sMib × 1.049e+6'; | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function describe($value, $fromUnits, $toUnits, int $precision = null) | ||
{ | ||
$result = $this->calculator->mul($value, 1049000); | ||
|
||
$this->plugVariables($result, $value); | ||
|
||
return $result; | ||
} | ||
} |
Oops, something went wrong.