23 lines
455 B
Python
23 lines
455 B
Python
|
from io import StringIO
|
||
|
import pytest
|
||
|
|
||
|
from assembler.assembler import Assembler
|
||
|
|
||
|
|
||
|
def test_commands(basic_machine_definition):
|
||
|
memory_definition, command_defintion = basic_machine_definition
|
||
|
|
||
|
data = StringIO(
|
||
|
'''
|
||
|
ldi r0, 0xfe
|
||
|
ldi r1, 0xfe
|
||
|
add r0, r1
|
||
|
'''
|
||
|
)
|
||
|
assembler = Assembler(data, memory_definition, command_defintion, {})
|
||
|
assembler.parse()
|
||
|
|
||
|
assert assembler._code_objects == [32704, 0, 0xfe
|
||
|
, 32704, 1, 0xfe
|
||
|
, 40896, 0, 1]
|