def test_stack_push_pop(): stk = Stack() stk.push(2) stk.push(3) assert stk.peek() == 3 assert stk.pop() == 3 assert stk.peek() == 2 assert stk.pop() == 2
def test_stack_swap(): stk = Stack() stk.push(2) stk.push(3) stk.swap() assert stk.peek() == 2 assert stk.pop() == 2 assert stk.peek() == 3 assert stk.pop() == 3
def test_executor_g(): lines = [['>', 'v'], ['<', '^']] fld = Field(2, 2, lines) stk = Stack() crt = Caret(stk, fld) stk.push(1) stk.push(0) exec_g(crt) assert stk.peek() == ord('v')