import name
import cornellasserts

"""This is an example of a unit test for the function last_name_first.
   It has multiple test cases of the function.

   Usage: at the command line, simply type:
   > python name_unit_test.py

   Precondition: the modules name and cornellasserts must be 
   in the same directory as this module.

   NOTE: last_name_first in its current state has a bug in it. 
   If you run this script, it will fail an assert and quit
   with an error. This is correct behavior! """


def test_last_name_first():
    """This is the unit test for the function last_name_first"""
    print('Testing function last_name_first')

    # Test 1
    print("Test #1:")
    result = name.last_name_first('Maya Angelou')
    cornellasserts.assert_equals('Angelou, Maya', result)
    print("Test #1 must have been successful or else I would have quit before printing this line")

    # Test 2
    print("Test #2:")
    result = name.last_name_first('Maya               Angelou')        
    cornellasserts.assert_equals('Angelou, Maya', result)
    print("Test #2 must have been successful or else I would have quit before printing this line")

# if you don't include this line, nothing will be tested!
test_last_name_first()

print('All tests of the function last_name_first passed')