*/ public static function distances(): iterable { yield 'exact' => ['40123456', '40123456', 0]; yield 'leading transposition' => ['40123456', '04123456', 1]; yield 'trailing transposition' => ['40123456', '40123465', 1]; yield 'single substitution' => ['40123456', '40123856', 1]; yield 'substitution and transposition' => ['12345678', '12345087', 2]; yield 'seven digits normalized with leading zero' => ['04123456', '4123456', 0]; yield 'more than two edits' => ['40123456', '87654321', 7]; } #[DataProvider('distances')] public function test_it_calculates_damerau_levenshtein_distance( string $left, string $right, int $expected, ): void { $this->assertSame($expected, (new DniDistanceService)->distance($left, $right)); } }