@@ -13,3 +13,65 @@ def testSubtract(self):
1313 def testMultiply (self ):
1414 math = mathmanager ()
1515 self .assertEqual (math .multiply (0 , 3 ), 0 )
16+
17+ def testInterest (self ):
18+ math = mathmanager ()
19+ self .assertEqual (round (math .interest (1000 , 1 )), 3 )
20+
21+ #Interest rate
22+ #positive amount, term = 2
23+ def testInterest1 (self ):
24+ math = mathmanager ()
25+ self .assertEqual (math .interest (1000 , 2 ), 3 )
26+
27+ #positive amount, term = 3 (invalid)
28+ def testInterest2 (self ):
29+ math = mathmanager ()
30+ self .assertEqual (math .interest (1000 , 3 ), - 2 )
31+
32+ #negative amount, term = 1
33+ def testInterest3 (self ):
34+ math = mathmanager ()
35+ self .assertEqual (math .interest (- 1000 , 1 ), - 1 )
36+
37+ #add: positive amount, term = 1, 3, 0, -1
38+ # negative amount, term = 2, -1, 0, 3
39+ # zero amount, term = 1, 2, 3, 0, -1
40+
41+
42+ #Tax calculator
43+ #income in first bracket
44+ def testTax (self ):
45+ math = mathmanager ()
46+ self .assertEqual (math .tax (10000 ), 0 )
47+
48+ #income in second bracket
49+ def testTax1 (self ):
50+ math = mathmanager ()
51+ self .assertEqual (math .tax (15000 ), 486 )
52+
53+ #income in third bracket
54+ def testTax2 (self ):
55+ math = mathmanager ()
56+ self .assertEqual (math .tax (52000 ), 8232 )
57+
58+ #add income in all brackets, negative income, income equals each threashold
59+
60+
61+ #Degree classification calculator
62+ #combination of grades that get a 2:1
63+ def testDegree (self ):
64+ math = mathmanager ()
65+ self .assertEqual (math .degree (40 , 70 , 70 , 55 , 60 ), "2:1" )
66+
67+ #combination of grades that get a third
68+ def testDegree1 (self ):
69+ math = mathmanager ()
70+ self .assertEqual (math .degree (0 , 70 , 50 , 60 , 40 ), "third" )
71+
72+ #at least one negative grade
73+ def testDegree2 (self ):
74+ math = mathmanager ()
75+ self .assertEqual (math .degree (- 1 , 40 , 40 , 40 , 40 ), - 1 )
76+
77+ #add at least one grade higher than 100, combination of grades that get a fist, 2:2, fail
0 commit comments