Mercurial > lcfOS
comparison test/testmsp430asm.py @ 342:86b02c98a717 devel
Moved target directory
author | Windel Bouwman |
---|---|
date | Sat, 01 Mar 2014 15:40:31 +0100 |
parents | 4d204f6f7d4e |
children | 3bb7dcfe5529 |
comparison
equal
deleted
inserted
replaced
341:4d204f6f7d4e | 342:86b02c98a717 |
---|---|
2 | 2 |
3 import unittest | 3 import unittest |
4 from ppci.asmnodes import AInstruction, ABinop, AUnop, ASymbol, ALabel, ANumber | 4 from ppci.asmnodes import AInstruction, ABinop, AUnop, ASymbol, ALabel, ANumber |
5 from ppci.assembler import tokenize, Assembler | 5 from ppci.assembler import tokenize, Assembler |
6 from ppci.objectfile import ObjectFile | 6 from ppci.objectfile import ObjectFile |
7 import outstream | 7 from ppci.outstream import BinaryOutputStream |
8 from target import Label | 8 from ppci.target import Label |
9 from target.target_list import msp430target | 9 from ppci.target.target_list import msp430target |
10 from testasm import AsmTestCaseBase | 10 from testasm import AsmTestCaseBase |
11 | 11 |
12 | 12 |
13 class AssemblerMSP430TestCase(AsmTestCaseBase): | 13 class Msp430AssemblerTestCase(AsmTestCaseBase): |
14 def setUp(self): | 14 def setUp(self): |
15 self.t = msp430target | 15 self.t = msp430target |
16 self.obj = ObjectFile() | 16 self.obj = ObjectFile() |
17 self.o = outstream.BinaryOutputStream(self.obj) | 17 self.o = BinaryOutputStream(self.obj) |
18 self.o.selectSection('.text') | 18 self.o.selectSection('.text') |
19 self.a = Assembler(target=self.t, stream=self.o) | 19 self.a = Assembler(target=self.t, stream=self.o) |
20 | 20 |
21 def testMov(self): | 21 def testMov(self): |
22 self.feed("mov r14, r15") | 22 self.feed("mov r14, r15") |
32 | 32 |
33 def testReti(self): | 33 def testReti(self): |
34 self.feed("reti") | 34 self.feed("reti") |
35 self.check('0013') | 35 self.check('0013') |
36 | 36 |
37 def testMSPinstructionCount(self): | |
38 """ Check that there are 27 instructions """ | |
39 self.assertEqual(27, len(self.t.instructions)) | |
40 | |
41 | 37 |
42 if __name__ == '__main__': | 38 if __name__ == '__main__': |
43 unittest.main() | 39 unittest.main() |