view test/testmsp430asm.py @ 383:173e20a47fda

Added linker description loader
author Windel Bouwman
date Sun, 27 Apr 2014 17:40:39 +0200
parents 6df89163e114
children d056b552d3f4
line wrap: on
line source

#!/usr/bin/python

import unittest
from ppci.objectfile import ObjectFile
from ppci.outstream import BinaryOutputStream
from ppci.target.target_list import msp430target
from testasm import AsmTestCaseBase


class Msp430AssemblerTestCase(AsmTestCaseBase):
    def setUp(self):
        self.t = msp430target
        self.obj = ObjectFile()
        self.ostream = BinaryOutputStream(self.obj)
        self.ostream.select_section('code')
        self.assembler = msp430target.assembler

    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()