Пример #1
0
 def test_fibonacci(self):
     """Check correctness of fibonacci"""
     # just test first 30 terms
     fibs = (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610,
             987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025,
             121393, 196418, 317811)
     for n, f in enumerate(fibs):
         self.assertEqual(katas.fibonacci(n), fibs[n],
                          'The Fibonacci terms are incorrect')
     # passing a negative number should raise an exception
     with self.assertRaises(ValueError):
         katas.fibonacci(-13)
Пример #2
0
 def test_fibonacci(self):
     """Tests fibonacci function """
     self.assertEqual(katas.fibonacci(1), 0)
     self.assertEqual(katas.fibonacci(2), 1)
     self.assertEqual(katas.fibonacci(3), 1)
     self.assertEqual(katas.fibonacci(4), 2)
     self.assertEqual(katas.fibonacci(5), 3)
     self.assertEqual(katas.fibonacci(70), 117669030460994)
Пример #3
0
 def test_fibonacci(self):
     self.assertEqual(katas.fibonacci(10), 55)
Пример #4
0
 def test_fibonacci(self):
     self.assertEqual(katas.fibonacci(7), 8)
Пример #5
0
 def test_fibonacci(self):
     fib_answer = katas.fibonacci(50)
     self.fail(fib_answer, 12586269025)
 def test_fibonacci(self):
     self.assertEqual(fibonacci(8), 13)
Пример #7
0
 def test_fibonacci(self):
     self.assertEqual(katas.fibonacci(2), 1)
     self.assertEqual(katas.fibonacci(7), 13)
     self.assertEqual(katas.fibonacci(3), 2)
     self.assertEqual(katas.fibonacci(6), 8)
 def test_fibonacci(self):
     # self.fail("TODO: Write fibonacci unit test")
     self.assertEqual(katas.fibonacci(8), 13)
Пример #9
0
 def test_fibonacci(self):
     self.assertEqual(katas.fibonacci(15), 377)
     self.assertEqual(katas.fibonacci(8), 13)
     self.assertEqual(katas.fibonacci(10), 34)
 def test_fibonacci(self):
     self.assertEqual(katas.fibonacci(5), 3, "fibb broken")
Пример #11
0
 def test_fibonacci(self):
     self.assertTrue(katas.fibonacci(8), 21)