""" Below are the test cases I created for testing the correctness of your code. Please don't modify them when you push the file back to GitHub """ if __name__ == '__main__': test0 = ([], []) test1 = ([1], [1]) test2 = ([1,2], [2,1]) test3 = ([1,2,3], [3,2,1]) test4 = ([1,1,2,3,3], [3,3,2,1,1]) random_list0 = [random.randint(1,10) for _ in range(20)] test5 = (random_list0, random_list0[::-1]) random_list1 = [random.randint(1,10) for _ in range(100)] test6 = (random_list1, random_list1[::-1]) tests = [test0, test1, test2, test3, test4, test5, test6] for i, test in enumerate(tests): print "------------- Test " +str(i) + " -------------" print "-Test Input:" print test[0] print "-Expected Output:" print test[1] print "-Your Output:" head = createLinkedList(test[0]) your_head = reverseList(head) your_ans = getLinkedList(your_head) print your_ans assert your_ans == test[1], "Wrong return. Please try again." print '\n**** Congratulations! You have passed all the tests! ****'
Please don't modify them when you push the file back to GitHub """ if __name__ == '__main__': test0 = ([], [], []) test1 = ([1], [1], [1, 1]) test2 = ([1, 2], [3, 4, 5, 6], [1, 2, 3, 4, 5, 6]) test3 = ([1, 2, 3], [1, 2, 3], [ 1, 1, 2, 2, 3, 3, ]) tests = [test0, test1, test2, test3] for i, test in enumerate(tests): print "------------- Test " + str(i) + " -------------" print "-Test Input:" print test[0] print "-Expected Output:" print test[1] print "-Your Output:" head1 = createLinkedList(test[0]) head2 = createLinkedList(test[1]) your_head = mergeTwoLists(head1, head2) your_ans = getLinkedList(your_head) print your_ans assert your_ans == test[2], "Wrong return. Please try again." print '\n**** Congratulations! You have passed all the tests! ****'