You are here

public function TimeEfficientImplementationTest::testReversedSequences in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/sebastian/diff/tests/LCS/TimeEfficientImplementationTest.php \SebastianBergmann\Diff\LCS\TimeEfficientImplementationTest::testReversedSequences()

File

vendor/sebastian/diff/tests/LCS/TimeEfficientImplementationTest.php, line 159

Class

TimeEfficientImplementationTest
Some of these tests are volontary stressfull, in order to give some approximative benchmark hints.

Namespace

SebastianBergmann\Diff\LCS

Code

public function testReversedSequences() {
  $from = array(
    'A',
    'B',
  );
  $to = array(
    'B',
    'A',
  );
  $expected = array(
    'A',
  );
  $common = $this->implementation
    ->calculate($from, $to);
  $this
    ->assertEquals($expected, $common);
  foreach ($this->stress_sizes as $size) {
    $from = range(1, $size);
    $to = array_reverse($from);
    $common = $this->implementation
      ->calculate($from, $to);
    $this
      ->assertEquals(array(
      1,
    ), $common);
  }
}