mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-02 09:38:32 +01:00
37 lines
720 B
PHP
37 lines
720 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Str;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Str;
|
|
|
|
class LevenshteinTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider provideData
|
|
*/
|
|
public function testLevenshtein(
|
|
int $expected,
|
|
string $a,
|
|
string $b,
|
|
?int $coi = null,
|
|
?int $cor = null,
|
|
?int $cod = null
|
|
): void {
|
|
self::assertSame($expected, Str\levenshtein($a, $b, $coi, $cor, $cod));
|
|
}
|
|
|
|
public function provideData(): array
|
|
{
|
|
return [
|
|
[0, 'o', 'o'],
|
|
[1, 'foo', 'oo'],
|
|
[1, 'oo', 'foo'],
|
|
[6, 'saif', 'azjezz'],
|
|
[48, 'saif', 'azjezz', 9, 8, 5]
|
|
];
|
|
}
|
|
}
|