-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_Kyu06.py
103 lines (97 loc) · 3.18 KB
/
test_Kyu06.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
import Kyu06
#
# Test code for the functions in Kyu06.py
#
# python -m doctest -v test_Kyu06.py
#
def comp_test():
"""
>>> Kyu06.comp([121, 144, 19, 161, 19, 144, 19, 11], [11*11, 121*121, 144*144, 19*19, 161*161, 19*19, 144*144, 19*19])
True
>>> Kyu06.comp([73, 22, 15, 74, 17, 41, 78], [5329, 485, 225, 5476, 289, 1681, 6084])
False
>>> Kyu06.comp([81, 19], [6561, 361])
True
>>> Kyu06.comp([37], [1370])
False
>>> Kyu06.comp([15, 32, 100, 31, 11, 31, 40, 28], [225, 1024, 10000, 961, 121, 962, 1600, 784])
False
>>> Kyu06.comp([15, 98, 12, 66, 83, 36, 0], [225, 9604, 144, 4356, 6889, 1296, 0])
True
>>> Kyu06.comp([92, 0, 28, 81, 2, 26], [8464, 0, 784, 6561, 4, 676])
True
>>> Kyu06.comp([37, 76, 2], [1369, 5776, 4])
True
>>> Kyu06.comp([20, 89, 9, 66, 95, 74], [400, 7921, 81, 4356, 9025, 5476])
True
>>> Kyu06.comp([52, 47, 52, 1], [2705, 2209, 2704, 1])
False
>>> Kyu06.comp([80], [6400])
True
>>> Kyu06.comp([18, 32, 79, 92, 59, 15], [324, 1024, 6241, 8464, 3481, 225])
True
"""
return
def revrot_test():
"""
>>> Kyu06.revrot("123456987654", 6)
'234561876549'
>>> Kyu06.revrot("123456987653", 6)
'234561356789'
>>> Kyu06.revrot("66443875", 4)
'44668753'
>>> Kyu06.revrot("66443875", 8)
'64438756'
>>> Kyu06.revrot("664438769", 8)
'67834466'
>>> Kyu06.revrot("123456779", 8)
'23456771'
>>> Kyu06.revrot("", 8)
''
>>> Kyu06.revrot("123456779", 0)
''
>>> Kyu06.revrot("563000655734469485", 4)
'0365065073456944'
>>> Kyu06.revrot("733049910872815764",5)
'330479108928157'
"""
return
def order_test():
"""
>>> Kyu06.order("is2 Thi1s T4est 3a")
'Thi1s is2 3a T4est'
>>> Kyu06.order("4of Fo1r pe6ople g3ood th5e the2")
'Fo1r the2 g3ood 4of th5e pe6ople'
>>> Kyu06.order("d4o dru7nken sh2all w5ith s8ailor wha1t 3we a6")
'wha1t sh2all 3we d4o w5ith a6 dru7nken s8ailor'
>>> Kyu06.order("3 6 4 2 8 7 5 1 9")
'1 2 3 4 5 6 7 8 9'
"""
return
def data_reverse_test():
"""
>>> Kyu06.data_reverse([1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,1,0,1,0])
[1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1]
>>> Kyu06.data_reverse([0,0,1,1,0,1,1,0,0,0,1,0,1,0,0,1])
[0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0]
"""
return
def test_expanded_form():
"""
>>> Kyu06.expanded_form(12)
'10 + 2'
>>> Kyu06.expanded_form(42)
'40 + 2'
>>> Kyu06.expanded_form(70304)
'70000 + 300 + 4'
>>> Kyu06.expanded_form(420370022)
'400000000 + 20000000 + 300000 + 70000 + 20 + 2'
>>> Kyu06.expanded_form(70304)
'70000 + 300 + 4'
>>> Kyu06.expanded_form(9000000)
'9000000'
>>> Kyu06.expanded_form(92093403034573)
'90000000000000 + 2000000000000 + 90000000000 + 3000000000 + 400000000 + 3000000 + 30000 + 4000 + 500 + 70 + 3'
>>> Kyu06.expanded_form(2096039485293)
'2000000000000 + 90000000000 + 6000000000 + 30000000 + 9000000 + 400000 + 80000 + 5000 + 200 + 90 + 3'
"""