|
| testAdd (string $a, string $b, string $result, int $scale) |
|
| testSub (string $a, string $b, string $result, int $scale) |
|
| testMul (string $a, string $b, string $result, int $scale) |
|
| testDiv (string $a, string $b, string $result, int $scale) |
|
| testSqrt (string $a, string $result, ?int $scale) |
|
| testPow (string $a, string $b, string $result, ?int $scale) |
|
| testMod (string $a, string $b, string $result) |
|
| testEquals (string $a, string $b, bool $result, ?int $scale) |
|
| testCalculation (string $formula, string $result, int $scale) |
|
| testDivisionsByZero () |
|
| testModuloByZero () |
|
|
| assertEqualNumbers (string $actual, string $expected) |
| This method is used as a 'Comparator' for two numeric strings and is equal to the ScalarComparator behaviour of PHPUnit 5.x In PHPUnit 8 the ScalarComparators uses a strict string comparison, so numbers with a different amount of trailing 0 decimals are not equal anymore. More...
|
|
◆ addData()
static ilMathBaseAdapterTestCase::addData |
( |
| ) |
|
|
static |
◆ assertEqualNumbers()
ilMathBaseAdapterTestCase::assertEqualNumbers |
( |
string |
$actual, |
|
|
string |
$expected |
|
) |
| |
|
private |
This method is used as a 'Comparator' for two numeric strings and is equal to the ScalarComparator behaviour of PHPUnit 5.x In PHPUnit 8 the ScalarComparators uses a strict string comparison, so numbers with a different amount of trailing 0 decimals are not equal anymore.
- See also
- Parameters
-
string | $actual | |
string | $expected | |
PhpUnitTestsInspection
Definition at line 51 of file ilMathBaseAdapterTestCase.php.
Referenced by testAdd(), testCalculation(), testDiv(), testEquals(), testMod(), testMul(), testPow(), testSqrt(), and testSub().
53 $differ =
new Differ(
new UnifiedDiffOutputBuilder(
"\n--- Expected\n+++ Actual\n"));
56 $this->assertTrue($actual == $expected, $differ->diff($actual, $expected));
◆ calcData()
static ilMathBaseAdapterTestCase::calcData |
( |
| ) |
|
|
static |
Definition at line 227 of file ilMathBaseAdapterTestCase.php.
230 [
'3+5',
'8', self::DEFAULT_SCALE],
231 [
'-3+5',
'2', self::DEFAULT_SCALE],
232 [
'3*6+5',
'23', self::DEFAULT_SCALE],
233 [
'10/2',
'5', self::DEFAULT_SCALE],
234 [
'13/60',
'0.2166666666666', 13],
235 [
'(-(-8)-sqrt((-8)^2-4*(7)))/(2)',
'1', self::DEFAULT_SCALE],
236 [
'(-(-8)+sqrt((-8)^2-4*(7)))/(2)',
'7', self::DEFAULT_SCALE],
237 [
'(-(-41)-sqrt((-41)^2-4*(1)*(5)))/(2*(1))',
'0.122', 3],
238 [
'(-(-41)+sqrt((-41)^2-4*(1)*(5)))/(2*(1))',
'40.877', 3],
239 [
'4^2-2*4+0.5*-16',
'0', self::DEFAULT_SCALE],
240 [
'-2^2-2*-2+0.5*-16',
'-8', self::DEFAULT_SCALE]
◆ divData()
static ilMathBaseAdapterTestCase::divData |
( |
| ) |
|
|
static |
- Returns
- array
Definition at line 171 of file ilMathBaseAdapterTestCase.php.
174 'Division with integer operands' => [
'1',
'2',
'0.5', self::DEFAULT_SCALE],
175 'Division with empty string operand' => [
'',
'2',
'0', self::DEFAULT_SCALE],
176 'Division with decimal operands' => [
'3.75',
'2.5',
'1.5', self::DEFAULT_SCALE],
◆ equalsData()
static ilMathBaseAdapterTestCase::equalsData |
( |
| ) |
|
|
static |
- Returns
- array
Definition at line 216 of file ilMathBaseAdapterTestCase.php.
References null.
219 [
'3',
'3',
true,
null],
220 [
'27.424',
'27.424',
true, 5]
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ modData()
static ilMathBaseAdapterTestCase::modData |
( |
| ) |
|
|
static |
◆ mulData()
static ilMathBaseAdapterTestCase::mulData |
( |
| ) |
|
|
static |
- Returns
- array
Definition at line 159 of file ilMathBaseAdapterTestCase.php.
162 'Multiplication with integer operands' => [
'1',
'2',
'2', self::DEFAULT_SCALE],
163 'Multiplication with empty string operand' => [
'1',
'',
'0', self::DEFAULT_SCALE],
164 'Multiplication with decimal operands' => [
'1.5',
'2.5',
'3.75', self::DEFAULT_SCALE]
◆ powData()
static ilMathBaseAdapterTestCase::powData |
( |
| ) |
|
|
static |
◆ setUp()
ilMathBaseAdapterTestCase::setUp |
( |
| ) |
|
|
protected |
◆ sqrtData()
static ilMathBaseAdapterTestCase::sqrtData |
( |
| ) |
|
|
static |
- Returns
- array
Definition at line 193 of file ilMathBaseAdapterTestCase.php.
References null.
196 [
'9',
'3', self::DEFAULT_SCALE],
197 [
'4294967296',
'65536', self::DEFAULT_SCALE],
198 [
'12345678901234567890',
'3513641828',
null],
199 [
'12345678901234567890',
'3513641828.82', 2]
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ subData()
static ilMathBaseAdapterTestCase::subData |
( |
| ) |
|
|
static |
◆ testAdd()
ilMathBaseAdapterTestCase::testAdd |
( |
string |
$a, |
|
|
string |
$b, |
|
|
string |
$result, |
|
|
int |
$scale |
|
) |
| |
Definition at line 60 of file ilMathBaseAdapterTestCase.php.
References assertEqualNumbers().
assertEqualNumbers(string $actual, string $expected)
This method is used as a 'Comparator' for two numeric strings and is equal to the ScalarComparator be...
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
◆ testCalculation()
ilMathBaseAdapterTestCase::testCalculation |
( |
string |
$formula, |
|
|
string |
$result, |
|
|
int |
$scale |
|
) |
| |
Definition at line 111 of file ilMathBaseAdapterTestCase.php.
References assertEqualNumbers().
113 $this->
assertEqualNumbers($result, ilMath::_applyScale($this->evalMath->evaluate($formula), $scale));
assertEqualNumbers(string $actual, string $expected)
This method is used as a 'Comparator' for two numeric strings and is equal to the ScalarComparator be...
◆ testDiv()
ilMathBaseAdapterTestCase::testDiv |
( |
string |
$a, |
|
|
string |
$b, |
|
|
string |
$result, |
|
|
int |
$scale |
|
) |
| |
Definition at line 78 of file ilMathBaseAdapterTestCase.php.
References assertEqualNumbers().
assertEqualNumbers(string $actual, string $expected)
This method is used as a 'Comparator' for two numeric strings and is equal to the ScalarComparator be...
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
◆ testDivisionsByZero()
ilMathBaseAdapterTestCase::testDivisionsByZero |
( |
| ) |
|
Definition at line 119 of file ilMathBaseAdapterTestCase.php.
121 $this->expectException(ilMathDivisionByZeroException::class);
123 $this->mathAdapter->div(1, 0);
◆ testEquals()
ilMathBaseAdapterTestCase::testEquals |
( |
string |
$a, |
|
|
string |
$b, |
|
|
bool |
$result, |
|
|
?int |
$scale |
|
) |
| |
Definition at line 105 of file ilMathBaseAdapterTestCase.php.
References assertEqualNumbers().
assertEqualNumbers(string $actual, string $expected)
This method is used as a 'Comparator' for two numeric strings and is equal to the ScalarComparator be...
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
◆ testMod()
ilMathBaseAdapterTestCase::testMod |
( |
string |
$a, |
|
|
string |
$b, |
|
|
string |
$result |
|
) |
| |
- Exceptions
-
Definition at line 99 of file ilMathBaseAdapterTestCase.php.
References assertEqualNumbers().
assertEqualNumbers(string $actual, string $expected)
This method is used as a 'Comparator' for two numeric strings and is equal to the ScalarComparator be...
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
◆ testModuloByZero()
ilMathBaseAdapterTestCase::testModuloByZero |
( |
| ) |
|
Definition at line 129 of file ilMathBaseAdapterTestCase.php.
131 $this->expectException(ilMathDivisionByZeroException::class);
133 $this->mathAdapter->mod(1, 0);
◆ testMul()
ilMathBaseAdapterTestCase::testMul |
( |
string |
$a, |
|
|
string |
$b, |
|
|
string |
$result, |
|
|
int |
$scale |
|
) |
| |
Definition at line 72 of file ilMathBaseAdapterTestCase.php.
References assertEqualNumbers().
assertEqualNumbers(string $actual, string $expected)
This method is used as a 'Comparator' for two numeric strings and is equal to the ScalarComparator be...
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
◆ testPow()
ilMathBaseAdapterTestCase::testPow |
( |
string |
$a, |
|
|
string |
$b, |
|
|
string |
$result, |
|
|
?int |
$scale |
|
) |
| |
Definition at line 90 of file ilMathBaseAdapterTestCase.php.
References assertEqualNumbers().
assertEqualNumbers(string $actual, string $expected)
This method is used as a 'Comparator' for two numeric strings and is equal to the ScalarComparator be...
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
◆ testSqrt()
ilMathBaseAdapterTestCase::testSqrt |
( |
string |
$a, |
|
|
string |
$result, |
|
|
?int |
$scale |
|
) |
| |
Definition at line 84 of file ilMathBaseAdapterTestCase.php.
References assertEqualNumbers().
assertEqualNumbers(string $actual, string $expected)
This method is used as a 'Comparator' for two numeric strings and is equal to the ScalarComparator be...
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
◆ testSub()
ilMathBaseAdapterTestCase::testSub |
( |
string |
$a, |
|
|
string |
$b, |
|
|
string |
$result, |
|
|
int |
$scale |
|
) |
| |
Definition at line 66 of file ilMathBaseAdapterTestCase.php.
References assertEqualNumbers().
assertEqualNumbers(string $actual, string $expected)
This method is used as a 'Comparator' for two numeric strings and is equal to the ScalarComparator be...
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
◆ $evalMath
EvalMath ilMathBaseAdapterTestCase::$evalMath |
|
protected |
◆ $mathAdapter
◆ DEFAULT_SCALE
const ilMathBaseAdapterTestCase::DEFAULT_SCALE = 50 |
|
protected |
The documentation for this class was generated from the following file: