예제 #1
0
def test_206():

    m = import_module(module_name)  
    s = m.Solution()
    fn, _ = inspect.getmembers(m.Solution, inspect.isfunction)[0]
    func = getattr(s, fn)

    
    head = build_head([1,2,3,4,5])
    Output = build_head([5,4,3,2,1])
    assert func(head) == Output
예제 #2
0
def test_23():

    m = import_module(module_name)
    s = m.Solution()
    fn, _ = inspect.getmembers(m.Solution, inspect.isfunction)[0]
    func = getattr(s, fn)

    lists = [build_head([1, 4, 5]), build_head([1, 3, 4]), build_head([2, 6])]

    Output = None
    assert func(lists) == Output
예제 #3
0
def test_61():

    m = import_module(module_name)
    s = m.Solution()
    fn, _ = inspect.getmembers(m.Solution, inspect.isfunction)[0]
    func = getattr(s, fn)

    head = build_head([1, 2, 3, 4, 5])
    k = 2
    Output = build_head([4, 5, 1, 2, 3])
    assert func(head, k).value_eq(Output)

    head = build_head([0, 1, 2])
    k = 4
    Output = build_head([2, 0, 1])
    assert func(head, k).value_eq(Output)

    head = build_head([1, 2])
    k = 1
    Output = build_head([2, 1])
    assert func(head, k).value_eq(Output)

    head = build_head([1, 2, 3])
    k = 2000000000
    # k = 2
    Output = build_head([2, 3, 1])
    assert func(head, k).value_eq(Output)
예제 #4
0
def test_19():

    m = import_module(module_name)  
    s = m.Solution()
    fn, _ = inspect.getmembers(m.Solution, inspect.isfunction)[0]
    func = getattr(s, fn)

    head = build_head([1,2,3,4,5])
    n = 2
    Output = build_head([1,2,3,5])

    head = build_head([1,2])
    n = 1

    # head = build_head([1])
    # n = 1

    # head = build_head([1,2])
    # n = 2
    assert func(head, n) == Output
예제 #5
0
def test_2():

    m = import_module(module_name)  
    s = m.Solution()
    fn, _ = inspect.getmembers(m.Solution, inspect.isfunction)[0]
    func = getattr(s, fn)

    l1 = [2, 4, 3]
    l1 = build_head(l1)
    l2 = [5, 6, 4]
    l2 = build_head(l2)
    Output = build_head([7, 0, 8])

    assert func(l1, l2) == Output

    l1 = [1]
    l1 = build_head(l1)
    l2 = [9, 9, 9]
    l2 = build_head(l2)
    Output = build_head([0,0,0,1])
    assert func(l1, l2) == Output

    # l1 = [1, 8]
    # l1 = build_head(l1)
    # l2 = [0]
    # l2 = build_head(l2)
    # Output = build_head([1,8])
    # assert func(l1, l2) == Output
예제 #6
0
def test_reverse_ll():
    l = [1, 2, 3, 4, 5]
    ll = build_head(l)
    print(ll)
    print(ll)
    print(ll)