*/ public function providerFceil(): array { return [ '5.5 must be 6' => [5.5, 6], '5.1234567890 with 5 must be 6' => [5.1234567890, 6], '6 must be 6' => [6, 6] ]; } /** * Undocumented function * * @covers ::fceil * @dataProvider providerFceil * @testdox fceil: Input $input must be $expected * * @param float $input * @param int $expected * @return void */ public function testMathFceilValue(float $input, int $expected): void { $this->assertEquals( $expected, \CoreLibs\Convert\Math::fceil($input) ); } /** * Undocumented function * * @return array */ public function providerFloor(): array { return [ '5123456 with -3 must be 5123000' => [5123456, -3, 5123000], '5123456 with -10 must be 5000000' => [5123456, -10, 5000000] ]; } /** * Undocumented function * * @covers ::floorp * @dataProvider providerFloor * @testdox floor: Input $input with cutoff $cutoff must be $expected * * @param int $input * @param int $cutoff * @param int $expected * @return void */ public function testMathFloorValue(int $input, int $cutoff, int $expected): void { $this->assertEquals( $expected, \CoreLibs\Convert\Math::floorp($input, $cutoff) ); } /** * Undocumented function * * @return array */ public function providerInitNumeric(): array { return [ '5 must be 5' => [5, 5, 'int'], '5.123 must be 5.123' => [5.123, 5.123, 'float'], "'5' must be 5" => ['5', 5, 'string'], "'5.123' must be 5.123" => ['5.123', 5.123, 'string'], ]; } /** * Undocumented function * * @covers ::initNumeric * @dataProvider providerInitNumeric * @testdox initNumeric: Input $info $input must match $expected [$_dataName] * * @param int|float|string $input * @param float $expected * @param string $info * @return void */ public function testMathInitNumericValue($input, float $expected, string $info): void { $this->assertEquals( $expected, \CoreLibs\Convert\Math::initNumeric($input) ); } /** * Undocumented function * * @return array */ public function providerCbrt(): array { return [ 'cube root of 2' => [2, 1.25992, 5], 'cube root of 3' => [3, 1.44225, 5], 'cube root of -1' => [-1, 'NAN', 0], ]; } /** * Undocumented function * * @covers ::cbrt * @dataProvider providerCbrt * @testdox initNumeric: Input $input must match $expected [$_dataName] * * @param float|int $number * @param float $expected * @param int $round_to * @return void */ public function testCbrt(float|int $number, float|string $expected, int $round_to): void { print "OUT: " . \CoreLibs\Convert\Math::cbrt($number) . "\n"; $this->assertEquals( $expected, round(\CoreLibs\Convert\Math::cbrt($number), $round_to) ); } /** * Undocumented function * * @return array */ public function providerMultiplyMatrices(): array { return [ 'single' => [ [1, 2, 3], [1, 2, 3], [14] ], 'double first' => [ [ [1, 2, 3], [1, 2, 3] ], [1, 2, 3], [ 14, 14 ] ], 'double both' => [ [ [1, 2, 3], [1, 2, 3], ], [ [1, 2, 3], [1, 2, 3], ], [ [3, 6, 9], [3, 6, 9] ] ], 'tripple first, single second' => [ [ [1, 2, 3], [1, 2, 3], [1, 2, 3], ], [1, 2, 3], [ 14, 14, 14 ] ], 'tripple first, double second' => [ [ [1, 2, 3], [1, 2, 3], [1, 2, 3], ], [ [1, 2, 3], [1, 2, 3], ], [ [3, 6, 9], [3, 6, 9], [3, 6, 9], ] ], 'single first, tripple second' => [ [1, 2, 3], [ [1, 2, 3], [1, 2, 3], [1, 2, 3], ], [ [6, 12, 18], ] ], 'double first, tripple second' => [ [ [1, 2, 3], [1, 2, 3], ], [ [1, 2, 3], [1, 2, 3], [1, 2, 3], ], [ [6, 12, 18], [6, 12, 18], ] ], ]; } /** * Undocumented function * * @covers ::multiplyMatrices * @dataProvider providerMultiplyMatrices * @testdox initNumeric: Input $input_a x $input_b must match $expected [$_dataName] * * @param array $input_a * @param array $input_b * @param array $expected * @return void */ public function testMultiplyMatrices(array $input_a, array $input_b, array $expected): void { $this->assertEquals( $expected, \CoreLibs\Convert\Math::multiplyMatrices($input_a, $input_b) ); } } // __END__