Sha256: dc62ea611339401eff61c40cef89ea0daee2f13defdd52a073fab9c3a1eb6638

Contents?: true

Size: 1.52 KB

Versions: 226

Compression:

Stored size: 1.52 KB

Contents

<?php

require_once 'binary-search.php';

class BinarySearchTest extends PHPUnit\Framework\TestCase
{
    public function testItWorksWithOneElement()
    {
        $this->assertEquals(0, find(6, [6]));
    }

    public function testItFindsValueInMiddle()
    {
        $this->markTestSkipped();
        $this->assertEquals(3, find(6, [1, 3, 4, 6, 8, 9, 11]));
    }

    public function testItFindsValueInBeginning()
    {
        $this->markTestSkipped();
        $this->assertEquals(0, find(1, [1, 3, 4, 6, 8, 9, 11]));
    }

    public function testItFindsValueAtEnd()
    {
        $this->markTestSkipped();
        $this->assertEquals(6, find(11, [1, 3, 4, 6, 8, 9, 11]));
    }

    public function testItFindsValueInOddLengthArray()
    {
        $this->markTestSkipped();
        $this->assertEquals(9, find(144, [1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 634]));
    }

    public function testItFindsValueInEvenLengthArray()
    {
        $this->markTestSkipped();
        $this->assertEquals(5, find(21, [1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377]));
    }
    public function testLowerThanLowestValueNotIn()
    {
        $this->markTestSkipped();
        $this->assertEquals(-1, find(0, [1, 3, 4, 6, 8, 9, 11]));
    }

    public function testLargerThanLargestValueNotIn()
    {
        $this->markTestSkipped();
        $this->assertEquals(-1, find(13, [1, 3, 4, 6, 8, 9, 11]));
    }

    public function testNothingInEmptyArray()
    {
        $this->markTestSkipped();
        $this->assertEquals(-1, find(1, []));
    }
}

Version data entries

226 entries across 226 versions & 1 rubygems

Version Path
trackler-2.1.0.41 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.40 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.39 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.38 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.37 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.36 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.34 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.33 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.32 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.31 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.30 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.29 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.28 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.27 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.26 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.25 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.24 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.23 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.22 tracks/php/exercises/binary-search/binary-search_test.php
trackler-2.1.0.21 tracks/php/exercises/binary-search/binary-search_test.php