示例#1
0
 def test_permutations_float(self):
     """permutations should use gamma function when floats as input"""
     self.assertFloatEqual(permutations(1.0,1), 1)
     self.assertFloatEqual(permutations(2,1.0), 2)
     self.assertFloatEqual(permutations(3.0,1.0), 3)
     self.assertFloatEqual(permutations(4.0,1), 4)
     self.assertFloatEqual(permutations(4.0,2.0), 12)
     self.assertFloatEqual(permutations(4.0,3.0), 24)
     self.assertFloatEqual(permutations(4,4.0), 24)
     self.assertFloatEqual(permutations(300, 100), 3.8807387193009318e+239)
示例#2
0
 def test_permutations(self):
     """permutations should return expected results"""
     self.assertEqual(permutations(1,1), 1)
     self.assertEqual(permutations(2,1), 2)
     self.assertEqual(permutations(3,1), 3)
     self.assertEqual(permutations(4,1), 4)
     self.assertEqual(permutations(4,2), 12)
     self.assertEqual(permutations(4,3), 24)
     self.assertEqual(permutations(4,4), 24)
     self.assertFloatEqual(permutations(300, 100), 3.8807387193009318e+239)
示例#3
0
 def test_permutations_float(self):
     """permutations should use gamma function when floats as input"""
     self.assertFloatEqual(permutations(1.0, 1), 1)
     self.assertFloatEqual(permutations(2, 1.0), 2)
     self.assertFloatEqual(permutations(3.0, 1.0), 3)
     self.assertFloatEqual(permutations(4.0, 1), 4)
     self.assertFloatEqual(permutations(4.0, 2.0), 12)
     self.assertFloatEqual(permutations(4.0, 3.0), 24)
     self.assertFloatEqual(permutations(4, 4.0), 24)
     self.assertFloatEqual(permutations(300, 100), 3.8807387193009318e+239)
示例#4
0
 def test_permutations(self):
     """permutations should return expected results"""
     self.assertEqual(permutations(1, 1), 1)
     self.assertEqual(permutations(2, 1), 2)
     self.assertEqual(permutations(3, 1), 3)
     self.assertEqual(permutations(4, 1), 4)
     self.assertEqual(permutations(4, 2), 12)
     self.assertEqual(permutations(4, 3), 24)
     self.assertEqual(permutations(4, 4), 24)
     self.assertFloatEqual(permutations(300, 100), 3.8807387193009318e+239)
示例#5
0
 def test_permutations_range(self):
     """permutations should increase gradually with increasing k"""
     start = 5 #permuations(10,5) = 30240
     end = 6 #permutations(10,6) = 151200
     step = 0.1
     lower_lim = 30240
     upper_lim = 151200
     previous_value = 30239.9999
     while start <= end:
         obs = permutations(10,start)
         assert lower_lim <= obs <= upper_lim
         assert obs > previous_value
         previous_value = obs
         start += step
示例#6
0
 def test_permutations_range(self):
     """permutations should increase gradually with increasing k"""
     start = 5  #permuations(10,5) = 30240
     end = 6  #permutations(10,6) = 151200
     step = 0.1
     lower_lim = 30240
     upper_lim = 151200
     previous_value = 30239.9999
     while start <= end:
         obs = permutations(10, start)
         assert lower_lim <= obs <= upper_lim
         assert obs > previous_value
         previous_value = obs
         start += step