def testJump(self): lines = [Label('f'), Jump('f'), Label('f$exit')] cfg = delinearise(lines) #self.assertTrue(cfg.has_path(cfg.entry, cfg.entry), msg=cfg) self.assertFalse(cfg.has_path(cfg.entry, cfg.exit), msg=cfg)
def testSimple(self): lines = [Label('f'), Label('f$exit')] cfg = delinearise(lines) self.assertEquals(cfg.entry.name, 'f') self.assertEquals(cfg.exit.name, 'f$exit') self.assertTrue(cfg.has_path(cfg.entry, cfg.exit))
def testSingleLine(self): lines = [Label('f'), Instruction(42), Label('f$exit')] cfg = delinearise(lines) self.assertTrue(cfg.has_path(cfg.entry, Operation(42), cfg.exit), msg=cfg)
def testForwardJump(self): lines = [Label('f'), Jump('f2'), Label('f2'), Label('f$exit')] cfg = delinearise(lines) self.assertTrue(cfg.has_path(cfg.entry, Pass(), cfg.exit), msg=cfg)