public function testXIndex() { // Translate a location in text1 to text2. $this->d->setChanges(array(array(Diff::DELETE, "a"), array(Diff::INSERT, "1234"), array(Diff::EQUAL, "xyz"))); $this->assertEquals(5, $this->d->xIndex(2)); // Translation on deletion. $this->d->setChanges(array(array(Diff::EQUAL, "a"), array(Diff::DELETE, "1234"), array(Diff::EQUAL, "xyz"))); $this->assertEquals(1, $this->d->xIndex(3)); }