import unittest

from Cryptotools.Numbers.numbers import fibonacci

class TestNumbers(unittest.TestCase):
    def _generate_fibonacci(self):
        # Source https://oeis.org/A000045
        with open("tests/fibonacci_oeis", "r") as f:
            data = f.readlines()
        fibo_s = data[0].split(",")
        fibo = list()
        for entry in fibo_s:
            fibo.append(int(entry.strip()))
        return fibo

    def test_fibonacci(self):
        fibo_oeis = self._generate_fibonacci()
        fibo = fibonacci(40)
        for i in range(0, len(fibo_oeis)):
            self.assertEqual(fibo[i], fibo_oeis[i], "Wrong value")

unittest.main()
