def test_equation_3 (self) : l = collatz_equation(2, cycleCache) self.assert_(l == 1)
def test_equation_1 (self) : l = collatz_equation(1, cycleCache) self.assert_(l == 0)
def test_equation_2 (self) : l = collatz_equation(4, cycleCache) self.assert_(l == 2)
# ------- # imports # ------- import StringIO import unittest from Collatz import collatz_read, collatz_eval, collatz_print, collatz_solve, collatz_equation # ---------------- # global variables # ---------------- cycleCache = [0] * 1000 for x in range(1, len(cycleCache) + 1): y = collatz_equation(x, cycleCache) cycleCache.insert(x, y) # ----------- # TestCollatz # ----------- class TestCollatz (unittest.TestCase) : # -------- # equation # -------- def test_equation_1 (self) : l = collatz_equation(1, cycleCache) self.assert_(l == 0)