def test_evaluation_from_compressed(self):
    '\n        Check if evaluation_from_compressed evaluates correctly the programs\n        '
    N = 20000
    deepcoder = DSL(semantics, primitive_types)
    type_request = Arrow(List(INT), List(INT))
    deepcoder_CFG = deepcoder.DSL_to_CFG(type_request)
    deepcoder_PCFG = deepcoder_CFG.CFG_to_Random_PCFG()
    gen_a_star = a_star(deepcoder_PCFG)
    environment = ([2, 3, 1], None)
    r = type_request.returns()
    for i in range(N):
        program_compressed = next(gen_a_star)
        program = reconstruct_from_compressed(program_compressed, r)
        program_as_list = []
        eval_from_compressed = evaluation_from_compressed(program_compressed, deepcoder, environment, r)
        eval_from_program = program.eval_naive(deepcoder, environment)
        self.assertEqual(eval_from_compressed, eval_from_program)
Check if evaluation_from_compressed evaluates correctly the programs
def test_evaluation_from_compressed(self):
    '\n        \n        '
    N = 20000
    deepcoder = DSL(semantics, primitive_types)
    type_request = Arrow(List(INT), List(INT))
    deepcoder_CFG = deepcoder.DSL_to_CFG(type_request)
    deepcoder_PCFG = deepcoder_CFG.CFG_to_Random_PCFG()
    gen_a_star = a_star(deepcoder_PCFG)
    environment = ([2, 3, 1], None)
    r = type_request.returns()
    for i in range(N):
        program_compressed = next(gen_a_star)
        program = reconstruct_from_compressed(program_compressed, r)
        program_as_list = []
        eval_from_compressed = evaluation_from_compressed(program_compressed, deepcoder, environment, r)
        eval_from_program = program.eval_naive(deepcoder, environment)
        self.assertEqual(eval_from_compressed, eval_from_program)