Skip to content

Commit ddefb43

Browse files
Test once using time-efficient LCS implementation and once using memory-efficient LCS implementation
1 parent 9dbd2e8 commit ddefb43

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

tests/DifferTest.php

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
namespace SebastianBergmann\Diff;
4545

4646
use PHPUnit_Framework_TestCase;
47+
use SebastianBergmann\Diff\LCS\MemoryEfficientImplementation;
48+
use SebastianBergmann\Diff\LCS\TimeEfficientImplementation;
4749

4850
class DifferTest extends PHPUnit_Framework_TestCase
4951
{
@@ -68,9 +70,9 @@ protected function setUp()
6870
* @dataProvider arrayProvider
6971
* @covers SebastianBergmann\Diff\Differ::diffToArray
7072
*/
71-
public function testArrayRepresentationOfDiffCanBeRendered(array $expected, $from, $to)
73+
public function testArrayRepresentationOfDiffCanBeRenderedUsingTimeEfficientLcsImplementation(array $expected, $from, $to)
7274
{
73-
$this->assertEquals($expected, $this->differ->diffToArray($from, $to));
75+
$this->assertEquals($expected, $this->differ->diffToArray($from, $to, new TimeEfficientImplementation));
7476
}
7577

7678
/**
@@ -80,9 +82,33 @@ public function testArrayRepresentationOfDiffCanBeRendered(array $expected, $fro
8082
* @dataProvider textProvider
8183
* @covers SebastianBergmann\Diff\Differ::diff
8284
*/
83-
public function testTextRepresentationOfDiffCanBeRendered($expected, $from, $to)
85+
public function testTextRepresentationOfDiffCanBeRenderedUsingTimeEfficientLcsImplementation($expected, $from, $to)
8486
{
85-
$this->assertEquals($expected, $this->differ->diff($from, $to));
87+
$this->assertEquals($expected, $this->differ->diff($from, $to, new TimeEfficientImplementation));
88+
}
89+
90+
/**
91+
* @param array $expected
92+
* @param string $from
93+
* @param string $to
94+
* @dataProvider arrayProvider
95+
* @covers SebastianBergmann\Diff\Differ::diffToArray
96+
*/
97+
public function testArrayRepresentationOfDiffCanBeRenderedUsingMemoryEfficientLcsImplementation(array $expected, $from, $to)
98+
{
99+
$this->assertEquals($expected, $this->differ->diffToArray($from, $to, new MemoryEfficientImplementation));
100+
}
101+
102+
/**
103+
* @param string $expected
104+
* @param string $from
105+
* @param string $to
106+
* @dataProvider textProvider
107+
* @covers SebastianBergmann\Diff\Differ::diff
108+
*/
109+
public function testTextRepresentationOfDiffCanBeRenderedUsingMemoryEfficientLcsImplementation($expected, $from, $to)
110+
{
111+
$this->assertEquals($expected, $this->differ->diff($from, $to, new MemoryEfficientImplementation));
86112
}
87113

88114
public function arrayProvider()

0 commit comments

Comments
 (0)