Esempio n. 1
0
def test_even_array():
    original_arr = [1, 2, 4, 5]
    original_val = 3

    actual = insertShiftArray(original_arr, original_val)
    expected = [1, 2, 3, 4, 5]
    assert expected == actual
Esempio n. 2
0
def test_empty_array():
    original_arr = []
    original_val = 1

    actual = insertShiftArray(original_arr, original_val)
    expected = [1]
    assert expected == actual
Esempio n. 3
0
def test_odd_array_2():
    original_arr = [1, 2, 3, 5, 6]
    original_val = 8

    actual = insertShiftArray(original_arr, original_val)
    expected = [1, 2, 3, 8, 5, 6]
    assert expected == actual
Esempio n. 4
0
def test_insert_a_val_into_the_middle_of_an_array():
    expected = [1, 2, 3, 11, 4, 5, 6]
    actual = insertShiftArray([1, 2, 3, 4, 5, 6], 11)
    assert expected is actual, "Happy path test passes"
Esempio n. 5
0
def test_should_print_nothing_if_array_is_empty():
    expected = []
    actual = insertShiftArray([], 11)
    assert expected is actual, "Expected failure test passes"
Esempio n. 6
0
def test_should_round_the_halfway_point_to_the_nearest_whole_number_if_array_length_is_odd(
):
    expected = [1, 2, 11, 3]
    actual = insertShiftArray([1, 2, 3], 11)
    assert expected is actual, "Edge case test passes"
def test_insertShiftArray_2():
    actual = insertShiftArray([1,3,5,7,9], 20)
    expected = [1,3,5,20,7,9]
    assert expected == actual
def test_insertShiftArray():
    actual = insertShiftArray([2,4,6,8], 5)
    expected =[2,4,5,6,8]
    assert expected == actual
def test_insertShiftArray_3():
    actual = insertShiftArray([5,10,15,20,25,30], 7)
    expected = [5,10,15,7,20,25,30]
    assert expected == actual        
def test_two():
    expected = [1, 2, 3, 4, 5, 6, 'Test', 7, 8, 9, 10, 11]
    actual = insertShiftArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], 'Test')
    assert actual == expected
def test_one():
    expected = [1, 2, 3, 'Test', 4, 5]
    actual = insertShiftArray([1, 2, 3, 4, 5], 'Test')
    assert actual == expected