-
Notifications
You must be signed in to change notification settings - Fork 0
/
Unit_Test.py
39 lines (33 loc) · 1.54 KB
/
Unit_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
from TRowTest import *
def unittest():
try:
results = (long_word_counter(sentence = 'The cow jumped over the moon.'))
if (results[0] == 'jumped') and (results[1]==6):
print ("test Passed: " + results[0] + ", " + str(results[1]))
else:
print ("test Failed: " + results[0] + ", " + str(results[1]))
except Exception as e:
print (e)
try:
results = (short_word_counter(sentence='The cow jumped over the moon?'))
if results[0] == 'cow' and results[1]==3:
print ("test Passed: " + results[0] + ", " + str(results[1]))
else:
print ("Test Failed: " + results[0] + ", " + str(results[1]))
except Exception as e:
print (e)
results = (short_word_counter(sentence='Add a method that returns the shortest word and length with unit tests!'))
if (results[0] == 'Add') and (results[1]==9):
print ("test Passed: " + results[0] + ", " + str(results[1]))
else:
print ("Test Failed: " + results[0] + ", " + str(results[1]) + " Intentionally FAILED test")
try:
results = (long_word_counter(sentence='Add a method that returns the shortest word and length with unit tests!'))
if results[0] == 'shortest' and results[1]==8:
print ("test Passed: " + results[0] + ", " + str(results[1]))
else:
print ("Test Failed: " + results[0] + ", " + str(results[1]))
except Exception as e:
print (e)
if __name__ == '__main__':
unittest()