Sha256: b1ed83090407fa2bef821e6b4e8c5ce2a247ac832a91f97aa6f5ee5a7cd3f088

Contents?: true

Size: 1.52 KB

Versions: 148

Compression:

Stored size: 1.52 KB

Contents

<?php

require 'flatten-array.php';

class FlattenArrayTest extends PHPUnit\Framework\TestCase
{
    public function testWithOutNesting()
    {
        $input = [0, 1, 2];
        $expected = [0, 1, 2];
        $this->assertEquals($expected, flatten($input));
    }
    public function testArrayWithJustIntegersPresent()
    {
        $this->markTestSkipped();
        $input = [1, [2, 3, 4, 5, 6, 7], 8];
        $expected = [1, 2, 3, 4, 5, 6, 7, 8];
        $this->assertEquals($expected, flatten($input));
    }

    public function testFiveLevelNesting()
    {
        $this->markTestSkipped();
        $input = [0, 2, [[2, 3], 8, 100, 4, [[[50]]]], -2];
        $expected = [0, 2, 2, 3, 8, 100, 4, 50, -2];
        $this->assertEquals($expected, flatten($input));
    }

    public function testSixLevelNesting()
    {
        $this->markTestSkipped();
        $input = [1, [2, [[3]], [4, [[5]]], 6, 7], 8];
        $expected = [1, 2, 3, 4, 5, 6, 7, 8];
        $this->assertEquals($expected, flatten($input));
    }
    public function testSixLevelNestListWithNullValues()
    {
        $this->markTestSkipped();
        $input = [0, 2, [[2, 3], 8, [[100]], null, [[null]]], -2];
        $expected = [0, 2, 2, 3, 8, 100, -2];
        $this->assertEquals($expected, flatten($input));
    }

    public function testAllValuesInNestedListAreNull()
    {
        $this->markTestSkipped();
        $input = [null, [[[null]]], null, null, [[null, null], null], null];
        $expected = [];
        $this->assertEquals($expected, flatten($input));
    }
}

Version data entries

148 entries across 148 versions & 1 rubygems

Version Path
trackler-2.2.1.159 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.158 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.157 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.156 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.155 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.154 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.153 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.152 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.151 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.150 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.149 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.148 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.147 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.146 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.145 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.144 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.143 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.142 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.141 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.140 tracks/php/exercises/flatten-array/flatten-array_test.php