mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-02 17:56:09 +01:00
56 lines
1.0 KiB
PHP
56 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Math;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Iter;
|
|
use Psl\Math;
|
|
|
|
class SumTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider provideData
|
|
*/
|
|
public function testSum(int $expected, array $numbers): void
|
|
{
|
|
self::assertSame($expected, Math\sum($numbers));
|
|
}
|
|
|
|
public function provideData(): array
|
|
{
|
|
return [
|
|
[
|
|
60,
|
|
[
|
|
10,
|
|
5,
|
|
...Iter\range(0, 9),
|
|
],
|
|
],
|
|
|
|
[
|
|
103,
|
|
[
|
|
18,
|
|
15,
|
|
...Iter\to_array(Iter\range(0, 10)),
|
|
15,
|
|
],
|
|
],
|
|
|
|
[
|
|
534,
|
|
[
|
|
178,
|
|
15,
|
|
...Iter\range(0, 45, 5),
|
|
52,
|
|
64,
|
|
]
|
|
],
|
|
];
|
|
}
|
|
}
|