Added fibonacci challenge.

This commit is contained in:
Donne Martin
2015-07-01 06:48:04 -04:00
parent 3a44e384ef
commit 0b5acdb52f
3 changed files with 227 additions and 29 deletions

View File

@@ -0,0 +1,21 @@
from nose.tools import assert_equal
class TestFib(object):
def test_fib(self, func):
result = []
for i in xrange(num_items):
result.append(func(i))
fib_seq = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
assert_equal(result, fib_seq)
print('Success: test_fib')
def main():
test = TestFib()
test.test_fib(fib_recursive)
test.test_fib(fib_dynamic)
test.test_fib(fib_iterative)
if __name__ == '__main__':
main()