Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_from_state_expr(self):
state = State.from_expr("m=0,x=1")
self.assertEqual(state, State(m=0, x=1))
state = State.from_expr("x=0,m=1")
self.assertEqual(state, State(x=0, m=1))
def test_from_state_expr(self):
state = State.from_expr("m=0,x=1")
self.assertEqual(state, State(m=0, x=1))
state = State.from_expr("x=0,m=1")
self.assertEqual(state, State(x=0, m=1))
def do_entrypoint(self, pc: str, name: str, state_expr: str) -> None:
"""Add an entry point to the analysis.
STATE_EXPR can accept the following values:
- "m=0,x=0" -> The subroutine changes the state of m to 0 and x to 0.
- "m=0,x=1" -> The subroutine changes the state of m to 0 and x to 1.
- "m=1,x=0" -> The subroutine changes the state of m to 1 and x to 0.
- "m=1,x=1" -> The subroutine changes the state of m to 1 and x to 1."""
if not pc.startswith("$"):
raise GilgameshError("Please specify a valid address.")
pc_int = self._label_to_pc(pc)
state = State.from_expr(state_expr)
self.log.add_entry_point(pc_int, name, state)