Beispiel #1
0
def test_binary():
    actual1 = BinarySearch([50, 90, 120, 500], 50)
    actual2 = BinarySearch([50, 90, 120, 500], 500)
    actual3 = BinarySearch([50, 90, 120, 500], 600)
    expected1 = 0
    expected2 = 3
    expected3 = -1
    assert actual1 == expected1
    assert actual2 == expected2
    assert actual3 == expected3
Beispiel #2
0
def test_binary2():
    actual = BinarySearch([11, 22, 33, 44, 55, 66, 77], 90)
    expected = -1
    assert actual == expected
Beispiel #3
0
def test_binary1():
    actual = BinarySearch([4, 8, 15, 16, 23, 42], 15)
    expected = 2
    assert actual == expected
Beispiel #4
0
def test_binary3():
    actual = BinarySearch([1, 2, 3, 5, 6, 7], 4)
    expected = -1
    assert actual == expected
Beispiel #5
0
def test_BinarySearch_one():

    actual = BinarySearch([4, 8, 15, 16, 23, 42], 15)
    expected = 2
    assert actual == expected, 'must return the index of the array’s element that is equal to the search key'
Beispiel #6
0
def test_BinarySearch_three():

    actual = BinarySearch([1, 2, 3, 5, 6, 7], 4)
    expected = -1
    assert actual == expected, 'must return  -1 if the element does not exist'
Beispiel #7
0
def test_BinarySearch_two():

    actual = BinarySearch([11, 22, 33, 44, 55, 66, 77], 90)
    expected = -1
    assert actual == expected, 'must return  -1 if the element does not exist'
def test_BinarySearch():
    expected = 4

    actual = BinarySearch([2, 3, 6, 8, 9], 9)

    assert actual == expected
def test2_BinarySearch():
    expected = -1

    actual = BinarySearch([2, 3, 6, 8, 9], 5)

    assert actual == expected
def test_BinarySearch2():
    excepted = -1
    actual = BinarySearch([11, 22, 33, 44, 55, 66, 77], 90)
    assert actual == excepted
def test_BinarySearch():
    excepted = 2
    actual = BinarySearch([4, 8, 15, 16, 23, 42], 15)
    assert actual == excepted
def test_BinarySearch3():
    excepted = -1
    actual = BinarySearch([1, 2, 3, 5, 6, 7], 4)
    assert actual == excepted
def test_one():
    actual = BinarySearch(arry, x)
    expected = 2
    assert actual == expected
def test_two():
    actual = BinarySearch(arry, x)
    expected = -1
    assert actual == expected