public function testLevenshtein()
 {
     // Levenshtein with trailing equality.
     $this->d->setChanges(array(array(Diff::DELETE, "abc"), array(Diff::INSERT, "1234"), array(Diff::EQUAL, "xyz")));
     $this->assertEquals(4, $this->d->levenshtein());
     // Levenshtein with leading equality.
     $this->d->setChanges(array(array(Diff::EQUAL, "xyz"), array(Diff::DELETE, "abc"), array(Diff::INSERT, "1234")));
     $this->assertEquals(4, $this->d->levenshtein());
     // Levenshtein with middle equality.
     $this->d->setChanges(array(array(Diff::DELETE, "abc"), array(Diff::EQUAL, "xyz"), array(Diff::INSERT, "1234")));
     $this->assertEquals(7, $this->d->levenshtein());
 }
 /**
  * Compute the Levenshtein distance; the number of inserted, deleted or substituted characters.
  *
  * @param array $diffs Array of diff arrays.
  *
  * @return int Number of changes.
  */
 public function diff_levenshtein($diffs)
 {
     $this->diff->setChanges($diffs);
     return $this->diff->levenshtein();
 }