view test/testmsp430asm.py @ 343:11c5a8a70c02 devel

Fix ide
author Windel Bouwman
date Sat, 01 Mar 2014 16:27:52 +0100
parents 86b02c98a717
children 3bb7dcfe5529
line wrap: on
line source

#!/usr/bin/python

import unittest
from ppci.asmnodes import AInstruction, ABinop, AUnop, ASymbol, ALabel, ANumber
from ppci.assembler import tokenize, Assembler
from ppci.objectfile import ObjectFile
from ppci.outstream import BinaryOutputStream
from ppci.target import Label
from ppci.target.target_list import msp430target
from testasm import AsmTestCaseBase


class Msp430AssemblerTestCase(AsmTestCaseBase):
    def setUp(self):
        self.t = msp430target
        self.obj = ObjectFile()
        self.o = BinaryOutputStream(self.obj)
        self.o.selectSection('.text')
        self.a = Assembler(target=self.t, stream=self.o)

    def testMov(self):
        self.feed("mov r14, r15")
        self.check('0F4E')

    def testMov1337(self):
        self.feed("mov 0x1337, r12")
        self.check('3C403713')

    def testAdd(self):
        self.feed("add r15, r13")
        self.check('0D5F')

    def testReti(self):
        self.feed("reti")
        self.check('0013')


if __name__ == '__main__':
    unittest.main()