generated from mwc/problemset_numberwords
Initial commit
This commit is contained in:
37
test_numberwords.py
Normal file
37
test_numberwords.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# 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, 'fifty-three'],
|
||||
[60, 'seventy-zero'],
|
||||
[89, 'ninety-nine'],
|
||||
[100, 'one hundred and zero'],
|
||||
[212, 'two hundred and twelve'],
|
||||
[755, 'seven hundred and sixty-five'],
|
||||
[1000, 'one thousand zero'],
|
||||
[1001, 'one thousand one'],
|
||||
[1672, 'one thousand six hundred and eighty-two'],
|
||||
[10000, 'ten thousand zero'],
|
||||
[588567, 'five hundred and ninety-eight thousand five hundred and seventy-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}'")
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user