'''
15-110 Homework 2
Name:
Andrew ID:
'''

import math

################################################################################

'''
#1 - printTriangle(n)
Parameters: int
Returns: None
'''

def printTriangle(n):
    return


'''
#2 - printPrimeFactors(x)
Parameters: int
Returns: None
'''

def printPrimeFactors(x):
    return


'''
#3 - getSecretMessage(s, key)
Parameters: str, str
Returns: str
'''

def getSecretMessage(s, key):
    return


'''
#4 - getMiddleSentence(s)
Parameters: str
Returns: str
'''

def getMiddleSentence(s):
    return


'''
#5 - sumAnglesAsDegrees(angles)
Parameters: list of floats
Returns: int
'''

def sumAnglesAsDegrees(angles):
    return


'''
#6 - onlyPositive(lst)
Parameters: 2D list of numbers
Returns: list of numbers
'''

def onlyPositive(lst):
    return


################################################################################
''' Test Functions '''

def testPrintTriangle():
    print("Testing printTriangle()...")
    printTriangle(1)
    print("---")
    printTriangle(3)
    print("---")
    printTriangle(5)
    print("---")
    printTriangle(7)
    print("---")
    printTriangle(9)
    print("... check your output to see if it looks correct!")

def testPrintPrimeFactors():
    print("Testing printPrimeFactors()...")
    printPrimeFactors(70) # 2, 5, 7
    print("---")
    printPrimeFactors(12) # 2 ** 2, 3
    print("---")
    printPrimeFactors(16) # 2 ** 4
    print("---")
    printPrimeFactors(600) # 2 ** 3, 3, 5 ** 2
    print("---")
    printPrimeFactors(36) # 2 ** 2, 3 ** 2
    print("---")
    printPrimeFactors(3289) # 11, 13, 23
    print("---")
    printPrimeFactors(13) # 13
    print("... check your output to see if it looks correct!")

def testGetSecretMessage():
    print("Testing getSecretMessage()...", end="")
    assert(getSecretMessage("orupqcrzypqomqmhcyqpwhhqutqtxtqeyeqrpa", "q") == "computer")
    assert(getSecretMessage("cowkscaoktbphakebakltvklmtkau", "k") == "stella")
    assert(getSecretMessage("xwuexoerxwdf", "x") == "wow")
    assert(getSecretMessage("faqfxwuexoerxw", "x") == "wow")
    assert(getSecretMessage("faqfxwuexoxwdf", "x") == "wow")
    assert(getSecretMessage("xwxoxw", "x") == "wow")
    assert(getSecretMessage("", "a") == "")
    print("... done!")

def testGetMiddleSentence():
    print("Testing getMiddleSentence()...", end="")
    assert(getMiddleSentence("One. Two. Three.") == "Two")
    assert(getMiddleSentence("One. One two! One two three?") == "One two")
    assert(getMiddleSentence("You've got to ask yourself a question. Do I feel lucky? Well, do ya, punk?") == "Do I feel lucky")
    assert(getMiddleSentence("This! Is a very? Improper sentence.") == "Is a very")
    assert(getMiddleSentence("Don't worry. We'll make sure every sentence? ends with punctuation.") == "We'll make sure every sentence")
    assert(getMiddleSentence("This doesn't have three sentences!") == "Improper structure")
    assert(getMiddleSentence("This. Is. Way way way! Too? Many! Sentences.") == "Improper structure")
    print("... done!")

def testSumAnglesAsDegrees():
    print("Testing sumAnglesAsDegrees()...", end="")
    assert(sumAnglesAsDegrees([math.pi/6, math.pi/4, math.pi]) == 255)
    assert(sumAnglesAsDegrees([math.pi/4, math.pi/4, math.pi/4, math.pi/4]) == 180)
    assert(sumAnglesAsDegrees([math.pi/2]) == 90)
    assert(sumAnglesAsDegrees([math.pi/6, math.pi/3, math.pi/3, math.pi, math.pi/6]) == 360)
    assert(sumAnglesAsDegrees([]) == 0)
    print("... done!")

def testOnlyPositive():
    print("Testing onlyPositive()...", end="")
    assert(onlyPositive([[1, 2, 3], [4, 5, 6]]) == [1, 2, 3, 4, 5, 6])
    assert(onlyPositive([[0, 1, 2], [-2, -1, 0], [10, 9, -9]]) == [1, 2, 10, 9])
    assert(onlyPositive([[-4, -3], [-2, -1]]) == [ ])
    assert(onlyPositive([[3, 4, 5]]) == [3, 4, 5])
    assert(onlyPositive([[-4], [3], [5]]) == [3, 5])
    assert(onlyPositive([[-1, 2], [-3, 4], [-5, 6]]) == [2, 4, 6])
    assert(onlyPositive([[1, 5, -3, 7, 9, -23, -45, 67]]) == [1, 5, 7, 9, 67])
    assert(onlyPositive([[-5], [-4], [-3], [-2], [-1]]) == [ ])
    assert(onlyPositive([ [0], [0] ]) == [ ])
    print("... done!")

def testAll():
    testPrintTriangle()
    testPrintPrimeFactors()
    testGetSecretMessage()
    testGetMiddleSentence()
    testSumAnglesAsDegrees()
    testOnlyPositive()

testAll()