Esempio n. 1
0
 def test_circleArea(self):
     input1 = 1
     output1 = math.pi
     self.assertEqual(output1, task.circleArea(input1))
     input2 = 0
     output2 = 0
     self.assertEqual(output2, task.circleArea(input2))
Esempio n. 2
0
    def testCircle(self):
        pi = math.pi

        expected1 = pi
        expected2 = pi * 4
        expected3 = pi * 9
        expected0 = 0
        self.assertEqual(expected1, task.circleArea(1))
        self.assertEqual(expected2, task.circleArea(2))
        self.assertEqual(expected3, task.circleArea(3))
        self.assertEqual(expected0, task.circleArea(0))
Esempio n. 3
0
 def testCircleArea(self):
     expected = 0
     self.assertEqual(expected, task.circleArea(0))
     i = 0
     while i < 10000:
         r = random.uniform(-10.0, 10.0)
         if r < 0:
             expected = None
         else:
             expected = math.pi * r**2
         self.assertAlmostEqual(expected, task.circleArea(r), places=8)
         i = i + 1
Esempio n. 4
0
 def test2(self):
     radius = 2.5
     expected = 19.625
     self.assertEqual(expected, task.circleArea(radius))
Esempio n. 5
0
 def test1(self):
     radius = 3
     expected = 28.26
     self.assertEqual(expected, task.circleArea(radius))
Esempio n. 6
0
 def test4(self):
     expected = 4
     self.assertNotEqual(expected, task.circleArea(4))
Esempio n. 7
0
 def test3(self):
     expected = 50.26548245743669
     self.assertEqual(expected, task.circleArea(4))
Esempio n. 8
0
 def testCircleArea(self):
     expected = 28.27431
     self.assertAlmostEqual(expected, task.circleArea(3), None, None, 0.01)
Esempio n. 9
0
    def test_circle_area(self):
        rad = 5
        self.assertEqual(78.5, task.circleArea(rad))

        rad = 7
        self.assertEqual(153.86, task.circleArea(rad))
Esempio n. 10
0
 def testArea(self):
     expected = math.pi
     self.assertAlmostEqual(expected, task.circleArea(1))