#################################################
# hw1.py
#
# Your name:
# Your andrew id:
#################################################

import math

#################################################
# Functions (for you to write)
#################################################


#### numberOfPoolBalls ####

def numberOfPoolBalls(rows):
    return 42

#### getTheCents ####

def getTheCents(n):
    return False

#### isPerfectCube ####

def isPerfectCube(n):
    return False

#### isSymmetricNumber ####

def isSymmetricNumber(n):
    return False

#### colorHarmony ####

def angleToRGB(h):
    return 42

def rgbToAngle(rgb):
    return 42

def colorHarmony(color1, color2):
    return 42

#################################################
# Test Functions (for you to test)
# Feel free to expand the test cases provided below
#################################################

#### numberOfPoolBalls ####

def testNumberOfPoolBalls():
    print('Testing numberOfPoolBalls()... ', end='')
    assert(numberOfPoolBalls(0) == 0)
    assert(numberOfPoolBalls(1) == 1)
    assert(numberOfPoolBalls(2) == 3)   # 1+2 == 3
    assert(numberOfPoolBalls(3) == 6)   # 1+2+3 == 6
    assert(numberOfPoolBalls(10) == 55)  # 1+2+...+10 == 55
    print('Passed.')


#### getTheCents ####

def testGetTheCents():
    print("Testing getTheCents()... ", end="")
    assert(getTheCents(42) == 0)
    assert(getTheCents(42.5) == 50)
    assert(getTheCents(42.50) == 50)
    assert(getTheCents("2022") == 0)
    assert(getTheCents(None) == 0)
    assert(getTheCents(42.42) == 42)
    print("Passed.")


#### isPerfectCube ####

def testIsPerfectCube():
    print('Testing isPerfectCube()... ', end='')
    assert(isPerfectCube(0) == True)
    assert(isPerfectCube(-1) == True)
    assert(isPerfectCube(1) == True)
    assert(isPerfectCube(16) == False)
    assert(isPerfectCube(8) == True)
    assert(isPerfectCube(1234**3) == True)
    assert(isPerfectCube(15) == False)
    assert(isPerfectCube(17) == False)
    assert(isPerfectCube(-16) == False)
    assert(isPerfectCube(-64) == True)
    assert(isPerfectCube(16.0000001) == False)
    assert(isPerfectCube('Do not crash here!') == False)
    print('Passed.')


#### isSymmetricNumber ####

def testIsSymmetricNumber():
    print("Testing isSymmetricNumber()... ", end="")
    assert(isSymmetricNumber(77) == True)
    assert(isSymmetricNumber(1) == False)
    assert(isSymmetricNumber(2020) == True)
    assert(isSymmetricNumber(987987) == True)
    assert(isSymmetricNumber(987789) == False)
    assert(isSymmetricNumber(111) == False)
    assert(isSymmetricNumber(1111) == True)
    assert(isSymmetricNumber(1111.0) == False)
    assert(isSymmetricNumber(-1111) == False)
    print("Passed.")


#### colorHarmony ####

def testRGBToAngle():
    print("Testing rgbToAngle()...", end="")
    assert(rgbToAngle(255000000)==0) # red
    assert(rgbToAngle(255128000)== 30) # orange
    assert(rgbToAngle(255234010)== None) # invalid: not at the perimeter
    print("Passed. (Add more tests to be more sure!)")


def testAngleToRGB():
    print("Testing ()...", end="")
    assert(angleToRGB(0)==255000000) #red
    assert(angleToRGB(360)==255000000) # same red
    assert(angleToRGB(0.2)==255001000) # very close to red
    assert(angleToRGB(30)==255128000) # orange
    print("Passed. (Add more tests to be more sure!)")


def testColorHarmony():
    print("Testing colorHarmony()...", end="")
    assert(colorHarmony(255038000,255034)==36000255)
    assert(colorHarmony(128255000,128000255)==255255)
    assert(colorHarmony(255255000,255000)==128000255)
    assert(colorHarmony(255128000,255128000)==None)
    print("Passed. (Add more tests to be more sure!)")

#################################################
# testAll and main
#################################################

def testAll():
    # comment out the tests you do not wish to run!
    testNumberOfPoolBalls()
    testGetTheCents()
    testIsPerfectCube()
    testIsSymmetricNumber()
    testRGBToAngle()
    testAngleToRGB()
    testColorHarmony()

def main():
    testAll()

if __name__ == '__main__':
    main()
