-
Notifications
You must be signed in to change notification settings - Fork 0
/
intnum_test.py
executable file
·115 lines (112 loc) · 14.1 KB
/
intnum_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/env python3
import unittest
from intnum import IntegerToEnglishLatin
class IntegerToEnglishLatinTest(unittest.TestCase):
def test_numbers(self):
converter = IntegerToEnglishLatin()
self.assertEqual(converter(0), 'zero')
self.assertEqual(converter(1), 'one')
self.assertEqual(converter(2), 'two')
self.assertEqual(converter(3), 'three')
self.assertEqual(converter(4), 'four')
self.assertEqual(converter(5), 'five')
self.assertEqual(converter(6), 'six')
self.assertEqual(converter(7), 'seven')
self.assertEqual(converter(8), 'eight')
self.assertEqual(converter(9), 'nine')
self.assertEqual(converter(10), 'ten')
self.assertEqual(converter(11), 'eleven')
self.assertEqual(converter(12), 'twelve')
self.assertEqual(converter(13), 'thirteen')
self.assertEqual(converter(14), 'fourteen')
self.assertEqual(converter(15), 'fifteen')
self.assertEqual(converter(16), 'sixteen')
self.assertEqual(converter(17), 'seventeen')
self.assertEqual(converter(18), 'eighteen')
self.assertEqual(converter(19), 'nineteen')
self.assertEqual(converter(20), 'twenty')
self.assertEqual(converter(21), 'twenty-one')
self.assertEqual(converter(22), 'twenty-two')
self.assertEqual(converter(23), 'twenty-three')
self.assertEqual(converter(24), 'twenty-four')
self.assertEqual(converter(25), 'twenty-five')
self.assertEqual(converter(26), 'twenty-six')
self.assertEqual(converter(27), 'twenty-seven')
self.assertEqual(converter(28), 'twenty-eight')
self.assertEqual(converter(29), 'twenty-nine')
self.assertEqual(converter(30), 'thirty')
self.assertEqual(converter(40), 'forty')
self.assertEqual(converter(50), 'fifty')
self.assertEqual(converter(60), 'sixty')
self.assertEqual(converter(70), 'seventy')
self.assertEqual(converter(80), 'eighty')
self.assertEqual(converter(90), 'ninety')
self.assertEqual(converter(100), 'one hundred')
self.assertEqual(converter(10**3), 'one thousand')
self.assertEqual(converter(10**6), 'one million')
self.assertEqual(converter(10**9), 'one billion')
self.assertEqual(converter(10**12), 'one trillion')
self.assertEqual(converter(10**15), 'one quadrillion')
self.assertEqual(converter(10**18), 'one quintillion')
self.assertEqual(converter(10**21), 'one sextillion')
self.assertEqual(converter(10**24), 'one septillion')
self.assertEqual(converter(10**27), 'one octillion')
self.assertEqual(converter(10**30), 'one nonillion')
self.assertEqual(converter(10**33), 'one decillion')
self.assertEqual(converter(10**36), 'one undecillion')
self.assertEqual(converter(10**39), 'one duodecillion')
self.assertEqual(converter(10**42), 'one tredecillion')
self.assertEqual(converter(10**45), 'one quattuordecillion')
self.assertEqual(converter(10**48), 'one quindecillion')
self.assertEqual(converter(10**51), 'one sexdecillion')
self.assertEqual(converter(10**54), 'one septendecillion')
self.assertEqual(converter(10**57), 'one octodecillion')
self.assertEqual(converter(10**60), 'one novemdecillion')
self.assertEqual(converter(10**63), 'one vigintillion')
self.assertEqual(converter(10**66), 'one unvigintillion')
self.assertEqual(converter(10**69), 'one duovigintillion')
self.assertEqual(converter(10**72), 'one trevigintillion')
self.assertEqual(converter(10**75), 'one quattuorvigintillion')
self.assertEqual(converter(10**78), 'one quinvigintillion')
self.assertEqual(converter(10**81), 'one sexvigintillion')
self.assertEqual(converter(10**84), 'one septenvigintillion')
self.assertEqual(converter(10**87), 'one octovigintillion')
self.assertEqual(converter(10**90), 'one novemvigintillion')
self.assertEqual(converter(10**93), 'one trigintillion')
self.assertEqual(converter(10**96), 'one untrigintillion')
self.assertEqual(converter(10**99), 'one duotrigintillion')
self.assertEqual(converter(10**102), 'one tretrigintillion')
self.assertEqual(converter(10**105), 'one quattuortrigintillion')
self.assertEqual(converter(10**108), 'one quintrigintillion')
self.assertEqual(converter(10**111), 'one sextrigintillion')
self.assertEqual(converter(10**114), 'one septentrigintillion')
self.assertEqual(converter(10**117), 'one octotrigintillion')
self.assertEqual(converter(10**120), 'one novemtrigintillion')
self.assertEqual(converter(10**123), 'one quadragintillion')
self.assertEqual(converter(10**153), 'one quinquagintillion')
self.assertEqual(converter(10**183), 'one sexagintillion')
self.assertEqual(converter(10**213), 'one septuagintillion')
self.assertEqual(converter(10**243), 'one octogintillion')
self.assertEqual(converter(10**273), 'one nonagintillion')
self.assertEqual(converter(10**303), 'one centillion')
self.assertEqual(converter(10**312), 'one trescentillion')
self.assertEqual(converter(10**903), 'one trecentillion')
self.assertEqual(converter(10**942), 'one tredecitrecentillion')
self.assertEqual(converter(10**1155), 'one quattuoroctogintatrecentillion')
self.assertEqual(converter(10**1368), 'one quinquinquagintaquadringentillion')
self.assertEqual(converter(10**1581), 'one sexvigintiquingentillion')
self.assertEqual(converter(10**1794), 'one septennonagintaquingentillion')
self.assertEqual(converter(10**2007), 'one octosexagintasescentillion')
self.assertEqual(converter(10**2220), 'one novemtrigintaseptingentillion')
self.assertEqual(converter(10**2433), 'one decioctingentillion')
self.assertEqual(converter(10**2646), 'one unoctogintaoctingentillion')
self.assertEqual(converter(10**2859), 'one duoquinquagintanongentillion')
self.assertEqual(converter(10**3003), 'one millinillion')
self.assertEqual(converter(-772813483771722728840176407357132870252343720539632545486182181180375969002426285408120956274643973897), 'negative seven hundred seventy-two duotrigintillion eight hundred thirteen untrigintillion four hundred eighty-three trigintillion seven hundred seventy-one novemvigintillion seven hundred twenty-two octovigintillion seven hundred twenty-eight septenvigintillion eight hundred forty sexvigintillion one hundred seventy-six quinvigintillion four hundred seven quattuorvigintillion three hundred fifty-seven trevigintillion one hundred thirty-two duovigintillion eight hundred seventy unvigintillion two hundred fifty-two vigintillion three hundred forty-three novemdecillion seven hundred twenty octodecillion five hundred thirty-nine septendecillion six hundred thirty-two sexdecillion five hundred forty-five quindecillion four hundred eighty-six quattuordecillion one hundred eighty-two tredecillion one hundred eighty-one duodecillion one hundred eighty undecillion three hundred seventy-five decillion nine hundred sixty-nine nonillion two octillion four hundred twenty-six septillion two hundred eighty-five sextillion four hundred eight quintillion one hundred twenty quadrillion nine hundred fifty-six trillion two hundred seventy-four billion six hundred forty-three million nine hundred seventy-three thousand eight hundred ninety-seven')
self.assertEqual(converter(-5786907833380334209193488109850123772270283030440494562540790958308245791645371738713739648843933287070), 'negative five tretrigintillion seven hundred eighty-six duotrigintillion nine hundred seven untrigintillion eight hundred thirty-three trigintillion three hundred eighty novemvigintillion three hundred thirty-four octovigintillion two hundred nine septenvigintillion one hundred ninety-three sexvigintillion four hundred eighty-eight quinvigintillion one hundred nine quattuorvigintillion eight hundred fifty trevigintillion one hundred twenty-three duovigintillion seven hundred seventy-two unvigintillion two hundred seventy vigintillion two hundred eighty-three novemdecillion thirty octodecillion four hundred forty septendecillion four hundred ninety-four sexdecillion five hundred sixty-two quindecillion five hundred forty quattuordecillion seven hundred ninety tredecillion nine hundred fifty-eight duodecillion three hundred eight undecillion two hundred forty-five decillion seven hundred ninety-one nonillion six hundred forty-five octillion three hundred seventy-one septillion seven hundred thirty-eight sextillion seven hundred thirteen quintillion seven hundred thirty-nine quadrillion six hundred forty-eight trillion eight hundred forty-three billion nine hundred thirty-three million two hundred eighty-seven thousand seventy')
self.assertEqual(converter(-8429509304806846689740701403558508696195856850627303729185549018678388126946645475171984230948287301894), 'negative eight tretrigintillion four hundred twenty-nine duotrigintillion five hundred nine untrigintillion three hundred four trigintillion eight hundred six novemvigintillion eight hundred forty-six octovigintillion six hundred eighty-nine septenvigintillion seven hundred forty sexvigintillion seven hundred one quinvigintillion four hundred three quattuorvigintillion five hundred fifty-eight trevigintillion five hundred eight duovigintillion six hundred ninety-six unvigintillion one hundred ninety-five vigintillion eight hundred fifty-six novemdecillion eight hundred fifty octodecillion six hundred twenty-seven septendecillion three hundred three sexdecillion seven hundred twenty-nine quindecillion one hundred eighty-five quattuordecillion five hundred forty-nine tredecillion eighteen duodecillion six hundred seventy-eight undecillion three hundred eighty-eight decillion one hundred twenty-six nonillion nine hundred forty-six octillion six hundred forty-five septillion four hundred seventy-five sextillion one hundred seventy-one quintillion nine hundred eighty-four quadrillion two hundred thirty trillion nine hundred forty-eight billion two hundred eighty-seven million three hundred one thousand eight hundred ninety-four')
self.assertEqual(converter(8817405800358002672340771631390960283474510886005300428485146825114502942212183012001306422680054928164), 'eight tretrigintillion eight hundred seventeen duotrigintillion four hundred five untrigintillion eight hundred trigintillion three hundred fifty-eight novemvigintillion two octovigintillion six hundred seventy-two septenvigintillion three hundred forty sexvigintillion seven hundred seventy-one quinvigintillion six hundred thirty-one quattuorvigintillion three hundred ninety trevigintillion nine hundred sixty duovigintillion two hundred eighty-three unvigintillion four hundred seventy-four vigintillion five hundred ten novemdecillion eight hundred eighty-six octodecillion five septendecillion three hundred sexdecillion four hundred twenty-eight quindecillion four hundred eighty-five quattuordecillion one hundred forty-six tredecillion eight hundred twenty-five duodecillion one hundred fourteen undecillion five hundred two decillion nine hundred forty-two nonillion two hundred twelve octillion one hundred eighty-three septillion twelve sextillion one quintillion three hundred six quadrillion four hundred twenty-two trillion six hundred eighty billion fifty-four million nine hundred twenty-eight thousand one hundred sixty-four')
self.assertEqual(converter(46327733089287107569823893182817317738252900361088000332693286452975275525138439332647602298250633139), 'forty-six duotrigintillion three hundred twenty-seven untrigintillion seven hundred thirty-three trigintillion eighty-nine novemvigintillion two hundred eighty-seven octovigintillion one hundred seven septenvigintillion five hundred sixty-nine sexvigintillion eight hundred twenty-three quinvigintillion eight hundred ninety-three quattuorvigintillion one hundred eighty-two trevigintillion eight hundred seventeen duovigintillion three hundred seventeen unvigintillion seven hundred thirty-eight vigintillion two hundred fifty-two novemdecillion nine hundred octodecillion three hundred sixty-one septendecillion eighty-eight sexdecillion three hundred thirty-two quattuordecillion six hundred ninety-three tredecillion two hundred eighty-six duodecillion four hundred fifty-two undecillion nine hundred seventy-five decillion two hundred seventy-five nonillion five hundred twenty-five octillion one hundred thirty-eight septillion four hundred thirty-nine sextillion three hundred thirty-two quintillion six hundred forty-seven quadrillion six hundred two trillion two hundred ninety-eight billion two hundred fifty million six hundred thirty-three thousand one hundred thirty-nine')
self.assertEqual(converter(2364641963025598692396925869239125822556498016441950523723059805522502416046135013136376310504248525502), 'two tretrigintillion three hundred sixty-four duotrigintillion six hundred forty-one untrigintillion nine hundred sixty-three trigintillion twenty-five novemvigintillion five hundred ninety-eight octovigintillion six hundred ninety-two septenvigintillion three hundred ninety-six sexvigintillion nine hundred twenty-five quinvigintillion eight hundred sixty-nine quattuorvigintillion two hundred thirty-nine trevigintillion one hundred twenty-five duovigintillion eight hundred twenty-two unvigintillion five hundred fifty-six vigintillion four hundred ninety-eight novemdecillion sixteen octodecillion four hundred forty-one septendecillion nine hundred fifty sexdecillion five hundred twenty-three quindecillion seven hundred twenty-three quattuordecillion fifty-nine tredecillion eight hundred five duodecillion five hundred twenty-two undecillion five hundred two decillion four hundred sixteen nonillion forty-six octillion one hundred thirty-five septillion thirteen sextillion one hundred thirty-six quintillion three hundred seventy-six quadrillion three hundred ten trillion five hundred four billion two hundred forty-eight million five hundred twenty-five thousand five hundred two')
if __name__ == '__main__':
unittest.main()