|
2 | 2 |
|
3 | 3 | use PHPUnit\Framework\ExpectationFailedException;
|
4 | 4 |
|
5 |
| -it('passes', function (int $sum, int $n, int $k, callable $step): void { |
6 |
| - expect($sum)->toBeSumOf($n, $k, $step); |
| 5 | +it('passes', function (int $sum, array $numbers): void { |
| 6 | + expect($sum)->toBeSumOf($numbers); |
7 | 7 | })->with([
|
8 |
| - [110, 0, 10, static fn (int $i): int => $i * 2], |
9 |
| - [418, 2, 20, static fn (int $i): int => $i * 2], |
10 |
| - [1628, 4, 40, static fn (int $i): int => $i * 2], |
11 |
| - [3630, 6, 60, static fn (int $i): int => $i * 2], |
12 |
| - [6424, 8, 80, static fn (int $i): int => $i * 2], |
| 8 | + [10, [3, 3, 4]], |
| 9 | + [20, [4, 4, 4, 4, 4]], |
| 10 | + [30, [5, 5, 5, 5, 5, 5]], |
| 11 | + [40, [6, 6, 6, 6, 6, 6, 4]], |
| 12 | + [50, [7, 7, 7, 7, 7, 7, 7, 1]], |
| 13 | + [72, [8, 8, 8, 8, 8, 8, 8, 8, 8]], |
| 14 | + [88, [9, 9, 9, 9, 9, 9, 9, 9, 9, 7]], |
| 15 | + [110, [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]], |
13 | 16 | ]);
|
14 | 17 |
|
15 |
| -it('passes not', function (int $n, int $k, callable $step): void { |
16 |
| - expect(1)->not->toBeSumOf($n, $k, $step); |
| 18 | +it('passes not', function (array $numbers): void { |
| 19 | + expect(1)->not->toBeSumOf($numbers); |
17 | 20 | })->with([
|
18 |
| - [0, 10, static fn (int $i): int => $i * 2], |
19 |
| - [2, 20, static fn (int $i): int => $i * 2], |
20 |
| - [4, 40, static fn (int $i): int => $i * 2], |
21 |
| - [6, 60, static fn (int $i): int => $i * 2], |
22 |
| - [8, 80, static fn (int $i): int => $i * 2], |
| 21 | + [[2, 3]], |
| 22 | + [[1, 2, 3]], |
| 23 | + [[1, 2, 3, 4]], |
| 24 | + [[1, 2, 3, 4, 5]], |
23 | 25 | ]);
|
24 | 26 |
|
25 | 27 | test('failures', function (): void {
|
26 |
| - expect(1)->toBeSumOf(0, 1, static fn (int $i): int => $i * 2); |
| 28 | + expect(1)->toBeSumOf([]); |
27 | 29 | })->throws(ExpectationFailedException::class);
|
28 | 30 |
|
29 | 31 | test('failures not', function (): void {
|
30 |
| - expect(2)->not->toBeSumOf(0, 1, static fn (int $i): int => $i * 2); |
| 32 | + expect(2)->not->toBeSumOf([2]); |
31 | 33 | })->throws(ExpectationFailedException::class);
|
0 commit comments