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