コード例 #1
0
 def testNotScalene(self):
     """isScalene should return False with not scalene triangles [2e79614fb2af8162]"""
     # another relevant test, but it suffers from the same problem as testScalene
     
     random.seed();
     
     for i in range(10):
         j = random.randint(2,10);
         t = [j, j, j];
         result = triangle.isNotTriangle(t);
         self.assertFalse(result);
         
         result = triangle.isScalene(t);
         self.assertFalse(result);
         
         t = [j, j, j+1];
         result = triangle.isNotTriangle(t);
         self.assertFalse(result);
         
         result = triangle.isScalene(t);
         self.assertFalse(result);
コード例 #2
0
 def testScalene(self):
     """isScalene should return True with scalene triangles [bc8859b03e2bc0fa]"""
     # this is a relevant test, but it does not adequately test the function
     # there are many more possible combinations of inputs
     
     random.seed();
     
     for i in range(10):
         j = random.randint(2,10);
         t = [j, j+1, j+2];
         result = triangle.isNotTriangle(t);
         self.assertFalse(result);
         
         result = triangle.isScalene(t);
         self.assertTrue(result);