def test_special_case_b0(self): H0 = dict([(n, hyperop(n)) for n in range(15)]) Hb = dict([(n, bounded_hyperop(n)) for n in range(15)]) for H in [H0, Hb]: for a in testing_values: assert H[0](a, 0) == 1 assert H[1](a, 0) == a assert H[2](a, 0) == 0 for n in range(3, 15): assert H[n](a, 0) == 1
def test_special_case_a0(self): H0 = dict([(n, hyperop(n)) for n in range(15)]) Hb = dict([(n, bounded_hyperop(n)) for n in range(15)]) for H in [H0, Hb]: for b in testing_values: assert H[0](0, b) == b + 1 assert H[1](0, b) == b assert H[2](0, b) == 0 assert H[3](0, b) == 0 for n in range(4, 15): assert H[n](0, b) == (b % 2 == 0)
def test_coorespondance(self): ''' Check if the bounded hyperop matches with the regular version for small values of a,b. ''' bound = hyperop(4)(3, 3) vals = range(1, 4) for N in range(0, 5): H = hyperop(N, primitive=True) Hb = bounded_hyperop(N, bound=bound, primitive=True) for a, b in itertools.product(vals, repeat=2): assert H(a, b) == Hb(a, b)
def test_complex_bounds(self): H = bounded_hyperop(4, bound=1000) assert H(5.0, 5) == H.infinity
def test_integer_bounds(self): H = bounded_hyperop(4, bound=1000) assert H(2, 5) == H.infinity