Ejemplo n.º 1
0
def main(argv):
    test1 = [[-12, 0, 4, 10], 4]
    test2 = [[0, 1, 2, 3, 4], 500]


    isCorrect = True
#    student = problemSet.Correct()

    test1_correct = str(correct_binary_search(test1[0], test1[1]))
    test1_student = str(Student.binary_search(test1[0], test1[1]))
    print "Correct Output: " + test1_correct
    print "Your Output: "    + test1_student 
    if compare(test1_correct, test1_student):
        print "Correct!"
    else:
        print "Incorrect"
        isCorrect = False

    test2_correct = str(correct_binary_search(test2[0], test2[1]))
    test2_student = str(Student.binary_search(test2[0], test2[1]))
    print "Correct Output: " + test2_correct
    print "Your Output: "    + test2_student 
    if compare(test2_correct, test2_student):
        print "Correct!"
    else:
        print "Incorrect"
        isCorrect = False
def main(argv):
    test1 = [[0,1,2,3], 0]
    test2 = [[-10,-3,0,45], -3]
    test3 = [[-12, 10, 23, 30], 30]

    isCorrect = True
#    student = problemSet.Correct()

    test1_correct = str(correct_binary_search(test1[0], test1[1]))
    test1_student = str(student.binary_search(test1[0], test1[1]))
    print "Correct Output: " + test1_correct
    print "Your Output: "    + test1_student 
    if compare(test1_correct, test1_student):
        print "Correct!"
    else:
        print "Incorrect"
        isCorrect = False

    test2_correct = str(correct_binary_search(test2[0], test2[1]))
    test2_student = str(student.binary_search(test2[0], test2[1]))
    print "Correct Output: " + test2_correct
    print "Your Output: "    + test2_student 
    if compare(test2_correct, test2_student):
        print "Correct!"
    else:
        print "Incorrect"
        isCorrect = False

    test3_correct = str(correct_binary_search(test3[0], test3[1]))
    test3_student = str(student.binary_search(test3[0], test3[1]))
    print "Correct Output: " + test3_correct
    print "Your Output: "    + test3_student 
    if compare(test3_correct, test3_student):
        print "Correct!"
    else:
        print "Incorrect"
        isCorrect = False