def test_fib_iterative(self): print("fib_iterative") self.assertEqual(1, Fibonacci.fib_iterative(1)) self.assertEqual(1, Fibonacci.fib_iterative(2)) self.assertEqual(8, Fibonacci.fib_iterative(6)) self.assertEqual(55, Fibonacci.fib_iterative(10)) self.assertEqual(144, Fibonacci.fib_iterative(12))
def test_fib_recursive_time(self): print("Time of recursive calculating of Fibonacci number (O(2^n)): "), start = time.clock() result = Fibonacci.fib_recursive(self.index) end = time.clock() print(str(end - start) + " s\n") self.assertEqual(self.number, result)