def test_walk_given_recursive_block(self): as_tree = ast.parse(ms("""\ z = 2 # 0th block while a < 3: # 1st block if a < 2: # 2nd block z = 2 # 3rd block b = 2 # 4th block c = 3 # 5th block """)) cfg_real = Cfg(as_tree) blocks_list = [] for blocks in cfg_real.walk_block(cfg_real.block_list[0]): blocks_list.append(blocks) pass
def test_walk_given_2_block(self): as_tree = ast.parse(ms("""\ z = 2 if z < 2: y = 3 """)) cfg_real = Cfg(as_tree) # cfg_real.walk_block(cfg_real.block_list[0]) blocks_list = [] for blocks in cfg_real.walk_block(cfg_real.block_list[0]): blocks_list.append(blocks) expected_block_list = build_blocks([3, 3, None], [1, 2, 'If'], block_links={'1': [0], '0':[]}) self.assertBasicBlockListEqual(blocks_list, expected_block_list)