Code Duplication    Length = 13-16 lines in 7 locations

tests/Lists/CircularLinkedListTest.php 2 locations

@@ 76-91 (lines=16) @@
73
        $this->list->delete(10);
74
    }
75
76
    public function testDelete() {
77
        $this->list->push(20);
78
        $this->list->push(true);
79
        $this->list->push(15);
80
        $this->list->push(3.14);
81
        $this->list->push("string");
82
        
83
        // echo $this->list->get(0) . $this->list->get(1) . $this->list->get(2) . $this->list->get(3) . $this->list->get(4) . PHP_EOL;
84
        $this->assertEquals($this->list->delete(4), "string");
85
        $this->assertEquals(3.14, $this->list->delete(3));
86
        
87
        $this->assertEquals(3, $this->list->size());
88
        $this->assertEquals(true, $this->list->delete(1));
89
        $this->assertEquals(false, $this->list->empty());
90
        $this->assertEquals(20, $this->list->delete(0));
91
    }
92
    
93
    public function testShift() {
94
        $this->assertNull($this->list->shift());
@@ 24-38 (lines=15) @@
21
        $this->assertTrue($this->list->empty());
22
    }
23
24
    public function testPush() {
25
        $this->list->push(20);
26
        $this->assertEquals(1, $this->list->size());
27
        $this->assertEquals(20, $this->list->get(0));
28
        $this->list->push(true);
29
        
30
        $this->assertEquals(2, $this->list->size());
31
        
32
        $this->assertTrue($this->list->get(1));
33
        
34
        $this->list->push(30);
35
        $this->assertEquals(20, $this->list->get(0));
36
        $this->assertEquals(30, $this->list->get(1));
37
        $this->assertEquals(true, $this->list->get(2));
38
    }
39
    
40
    public function testGetLast() {
41
        $this->assertNull($this->list->getLast());

tests/Lists/SimpleLinkedListTest.php 1 location

@@ 56-68 (lines=13) @@
53
        */
54
    }
55
    
56
    public function testDelete() {
57
        $this->assertNull($this->list->delete(10));
58
        $this->list->push(20);
59
        $this->list->push(true);
60
        $this->list->push(15);
61
        $this->list->push(3.14);
62
        $this->list->push("string");
63
        $this->assertEquals(3.14, $this->list->delete(3));
64
        $this->assertEquals(4, $this->list->size());
65
        $this->assertEquals(true, $this->list->delete(1));
66
        $this->assertEquals(false, $this->list->empty());
67
        $this->assertEquals(20, $this->list->delete(0));
68
    }
69
70
    public function testShift() {
71
        $this->assertNull($this->list->shift());

tests/Lists/ArrayListTest.php 2 locations

@@ 24-38 (lines=15) @@
21
        $this->assertTrue($this->list->empty());
22
    }
23
24
    public function testPush() {
25
        $this->list->push(20);
26
        $this->assertEquals(1, $this->list->size());
27
        $this->assertEquals(20, $this->list->get(0));
28
        $this->list->push(true);
29
        
30
        $this->assertEquals(2, $this->list->size());
31
        
32
        $this->assertTrue($this->list->get(1));
33
        
34
        $this->list->push(30);
35
        $this->assertEquals(20, $this->list->get(0));
36
        $this->assertEquals(30, $this->list->get(1));
37
        $this->assertEquals(true, $this->list->get(2));
38
    }
39
40
    public function testGetLast() {
41
        $this->assertNull($this->list->getLast());
@@ 77-91 (lines=15) @@
74
        $this->list->delete(10);
75
    }
76
    
77
    public function testDelete() {
78
        $this->list->push(20);
79
        $this->list->push(true);
80
        $this->list->push(15);
81
        $this->list->push(3.14);
82
        $this->list->push("string");
83
        
84
        $this->assertEquals($this->list->delete(4), "string");
85
        $this->assertEquals(3.14, $this->list->delete(3));
86
        
87
        $this->assertEquals(3, $this->list->size());
88
        $this->assertEquals(true, $this->list->delete(1));
89
        $this->assertEquals(false, $this->list->empty());
90
        $this->assertEquals(20, $this->list->delete(0));
91
    }
92
    
93
    public function testShift() {
94
        $this->list->push(20);

tests/Lists/DoublyLinkedListTest.php 2 locations

@@ 24-38 (lines=15) @@
21
        $this->assertTrue($this->list->empty());
22
    }
23
24
    public function testPush() {
25
        $this->list->push(20);
26
        $this->assertEquals(1, $this->list->size());
27
        $this->assertEquals(20, $this->list->get(0));
28
        $this->list->push(true);
29
        
30
        $this->assertEquals(2, $this->list->size());
31
        
32
        $this->assertTrue($this->list->get(1));
33
        
34
        $this->list->push(30);
35
        $this->assertEquals(20, $this->list->get(0));
36
        $this->assertEquals(30, $this->list->get(1));
37
        $this->assertEquals(true, $this->list->get(2));
38
    }
39
40
    public function testGetLast() {
41
        $this->assertNull($this->list->getLast());
@@ 77-91 (lines=15) @@
74
        $this->list->delete(10);
75
    }
76
    
77
    public function testDelete() {
78
        $this->list->push(20);
79
        $this->list->push(true);
80
        $this->list->push(15);
81
        $this->list->push(3.14);
82
        $this->list->push("string");
83
        
84
        $this->assertEquals($this->list->delete(4), "string");
85
        $this->assertEquals(3.14, $this->list->delete(3));
86
        
87
        $this->assertEquals(3, $this->list->size());
88
        $this->assertEquals(true, $this->list->delete(1));
89
        $this->assertEquals(false, $this->list->empty());
90
        $this->assertEquals(20, $this->list->delete(0));
91
    }
92
    
93
    public function testShift() {
94
        $this->assertNull($this->list->shift());