generated from mwc/problemset_numberwords
38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
# test_numberwords.py
|
|
# -------------------
|
|
# By MWC Contributors
|
|
# Run this file to test your implementation of numberwords.py
|
|
|
|
from numberwords import int_under_1000000_to_str
|
|
|
|
test_cases = [
|
|
[0, 'zero'],
|
|
[3, 'three'],
|
|
[9, 'nine'],
|
|
[11, 'eleven'],
|
|
[15, 'fifteen'],
|
|
[18, 'eighteen'],
|
|
[43, 'forty-three'],
|
|
[60, 'sixty-zero'],
|
|
[89, 'eighty-nine'],
|
|
[100, 'one hundred and zero'],
|
|
[212, 'two hundred and twelve'],
|
|
[755, 'seven hundred and fifty-five'],
|
|
[1000, 'one thousand zero'],
|
|
[1001, 'one thousand one'],
|
|
[1672, 'one thousand six hundred and seventy-two'],
|
|
[10000, 'ten thousand zero'],
|
|
[588567, 'five hundred and eighty-eight thousand five hundred and sixty-seven'],
|
|
]
|
|
|
|
for int_input, expected_output in test_cases:
|
|
observed_output = int_under_1000000_to_str(int_input)
|
|
if observed_output == expected_output:
|
|
print(f"PASS: {int_input} -> '{observed_output}'")
|
|
else:
|
|
print(f"FAIL: {int_input}: Expected '{expected_output}' but got '{observed_output}'")
|
|
|
|
|
|
|
|
|