def test_field_get(): lines = [['>', 'v'], ['^', '<']] fld = Field(2, 2, lines) assert fld.get_symbol_at(0, 0) == '>' assert fld.get_symbol_at(1, 0) == 'v' assert fld.get_symbol_at(0, 1) == '^' assert fld.get_symbol_at(1, 1) == '<'
def test_field_set(): lines = [['>', 'v'], ['<', '^']] fld = Field(2, 2, lines) fld.set_symbol_at(0, 0, 'v') fld.set_symbol_at(1, 0, '<') fld.set_symbol_at(1, 1, '^') fld.set_symbol_at(0, 1, '>') assert fld.get_symbol_at(0, 0) == 'v' assert fld.get_symbol_at(1, 0) == '<' assert fld.get_symbol_at(0, 1) == '>' assert fld.get_symbol_at(1, 1) == '^'
def test_executor_p(): lines = [['>', 'v'], ['<', '^']] fld = Field(2, 2, lines) stk = Stack() crt = Caret(stk, fld) stk.push(ord('@')) stk.push(1) stk.push(0) exec_p(crt) assert fld.get_symbol_at(1, 0) == '@'