Mercurial > lcfOS
view test/testmsp430asm.py @ 331:a78b41ff6ad2
Added better recipe files
author | Windel Bouwman |
---|---|
date | Fri, 07 Feb 2014 12:39:59 +0100 |
parents | 44f336460c2a |
children | 6f4753202b9a |
line wrap: on
line source
#!/usr/bin/python import unittest from asmnodes import AInstruction, ABinop, AUnop, ASymbol, ALabel, ANumber from asm import tokenize, Assembler import outstream from target import Label from target.target_list import msp430target from testasm import AsmTestCaseBase class AssemblerMSP430TestCase(AsmTestCaseBase): def setUp(self): self.t = msp430target self.o = outstream.BinOutputStream() self.o.selectSection('.text') self.a = Assembler(target=self.t, stream=self.o) def testMapMovInstruction(self): i = AInstruction('mov', [ASymbol('r14'), ASymbol('r15')]) ri = self.t.mapInstruction(i) def testMapRetiInstruction(self): i = AInstruction('reti', []) ri = self.t.mapInstruction(i) 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') def testMSPinstructionCount(self): """ Check that there are 27 instructions """ self.assertEqual(27, len(self.t.instructions)) if __name__ == '__main__': unittest.main()