Mercurial > lcfOS
view test/testmsp430asm.py @ 305:0615b5308710
Updated docs
author | Windel Bouwman |
---|---|
date | Fri, 06 Dec 2013 13:50:38 +0100 |
parents | 534b94b40aa8 |
children | 44f336460c2a |
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, 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()