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.180 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.179 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.178 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.177 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.176 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.175 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.174 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.173 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.172 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.171 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.170 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.169 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.167 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.166 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.165 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.164 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.163 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.162 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.161 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.160 tracks/php/exercises/flatten-array/flatten-array_test.php