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.58 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.57 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.56 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.55 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.54 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.53 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.52 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.51 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.50 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.49 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.48 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.47 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.46 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.45 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.44 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.43 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.42 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.41 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.40 tracks/php/exercises/flatten-array/flatten-array_test.php
trackler-2.2.1.39 tracks/php/exercises/flatten-array/flatten-array_test.php