""" Test script for the module anglicize Author: Walker M. White Date: September 6, 2017 (Python 3 Version) """ import cornell # cornell assert functions import anglicize # function to be tested def test_anglicize(): """ Test procedure for the primary anglicize function """ print('Testing anglicize') result = anglicize.anglicize(1) cornell.assert_equals("one", result) result = anglicize.anglicize(19) cornell.assert_equals("nineteen", result) result = anglicize.anglicize(20) cornell.assert_equals("twenty", result) result = anglicize.anglicize(35) cornell.assert_equals("thirty five", result) result = anglicize.anglicize(50) cornell.assert_equals("fifty", result) result = anglicize.anglicize(99) cornell.assert_equals("ninety nine", result) result = anglicize.anglicize(100) cornell.assert_equals("one hundred", result) result = anglicize.anglicize(301) cornell.assert_equals("three hundred one", result) result = anglicize.anglicize(999) cornell.assert_equals("nine hundred ninety nine", result) result = anglicize.anglicize(1000) cornell.assert_equals("one thousand", result) result = anglicize.anglicize(1009) cornell.assert_equals("one thousand nine", result) result = anglicize.anglicize(900000) cornell.assert_equals("nine hundred thousand", result) result = anglicize.anglicize(789436) cornell.assert_equals("seven hundred eighty nine thousand four hundred thirty six", result) def test_anglicize1000(): """ Test procedure for the helper function anglicize1000 """ print('Testing anglicize1000') result = anglicize.anglicize1000(1) cornell.assert_equals("one", result) result = anglicize.anglicize1000(19) cornell.assert_equals("nineteen", result) result = anglicize.anglicize1000(20) cornell.assert_equals("twenty", result) result = anglicize.anglicize1000(35) cornell.assert_equals("thirty five", result) result = anglicize.anglicize1000(50) cornell.assert_equals("fifty", result) result = anglicize.anglicize1000(99) cornell.assert_equals("ninety nine", result) result = anglicize.anglicize1000(100) cornell.assert_equals("one hundred", result) result = anglicize.anglicize1000(301) cornell.assert_equals("three hundred one", result) result = anglicize.anglicize1000(999) cornell.assert_equals("nine hundred ninety nine", result) def test_anglicize100to999(): """ Test procedure for the helper function anglicize100to999 """ print('Testing anglicize100to999') result = anglicize.anglicize100to999(100) cornell.assert_equals("one hundred", result) result = anglicize.anglicize100to999(301) cornell.assert_equals("three hundred one", result) result = anglicize.anglicize100to999(999) cornell.assert_equals("nine hundred ninety nine", result) def test_anglicize20to99(): """ Test procedure for the helper function anglicize20to99 """ print('Testing anglicize20to99') result = anglicize.anglicize20to99(35) cornell.assert_equals("thirty five", result) result = anglicize.anglicize20to99(50) cornell.assert_equals("fifty", result) result = anglicize.anglicize20to99(99) cornell.assert_equals("ninety nine", result) def test_anglicize1to19(): """ Test procedure for the helper function anglicize1to19 """ print('Testing anglicize1to19') result = anglicize.anglicize1to19(1) cornell.assert_equals("one", result) result = anglicize.anglicize1to19(2) cornell.assert_equals("two", result) result = anglicize.anglicize1to19(3) cornell.assert_equals("three", result) result = anglicize.anglicize1to19(4) cornell.assert_equals("four", result) result = anglicize.anglicize1to19(5) cornell.assert_equals("five", result) result = anglicize.anglicize1to19(6) cornell.assert_equals("six", result) result = anglicize.anglicize1to19(7) cornell.assert_equals("seven", result) result = anglicize.anglicize1to19(8) cornell.assert_equals("eight", result) result = anglicize.anglicize1to19(9) cornell.assert_equals("nine", result) result = anglicize.anglicize1to19(10) cornell.assert_equals("ten", result) result = anglicize.anglicize1to19(11) cornell.assert_equals("eleven", result) result = anglicize.anglicize1to19(12) cornell.assert_equals("twelve", result) result = anglicize.anglicize1to19(13) cornell.assert_equals("thirteen", result) result = anglicize.anglicize1to19(14) cornell.assert_equals("fourteen", result) result = anglicize.anglicize1to19(15) cornell.assert_equals("fifteen", result) result = anglicize.anglicize1to19(16) cornell.assert_equals("sixteen", result) result = anglicize.anglicize1to19(17) cornell.assert_equals("seventeen", result) result = anglicize.anglicize1to19(18) cornell.assert_equals("eighteen", result) result = anglicize.anglicize1to19(19) cornell.assert_equals("nineteen", result) def test_tens(): """ Test procedure for the helper function tens """ print('Testing tens') result = anglicize.tens(2) cornell.assert_equals("twenty", result) result = anglicize.tens(3) cornell.assert_equals("thirty", result) result = anglicize.tens(4) cornell.assert_equals("forty", result) result = anglicize.tens(5) cornell.assert_equals("fifty", result) result = anglicize.tens(6) cornell.assert_equals("sixty", result) result = anglicize.tens(7) cornell.assert_equals("seventy", result) result = anglicize.tens(8) cornell.assert_equals("eighty", result) result = anglicize.tens(9) cornell.assert_equals("ninety", result) # Script code if __name__ == '__main__': test_tens() test_anglicize1to19() test_anglicize20to99() test_anglicize100to999() test_anglicize1000() test_anglicize() print('Module anglicize is working correctly')