Mercurial > lcfOS
comparison test/testasm.py @ 347:742588fb8cd6 devel
Merge into devel branch
author | Windel Bouwman |
---|---|
date | Fri, 07 Mar 2014 17:10:21 +0100 |
parents | 3bb7dcfe5529 |
children | 442fb043d149 |
comparison
equal
deleted
inserted
replaced
343:11c5a8a70c02 | 347:742588fb8cd6 |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 import unittest, cProfile | 3 import unittest |
4 from ppci import CompilerError | 4 from ppci import CompilerError |
5 from ppci.asmnodes import AInstruction, ABinop, AUnop, ASymbol, ALabel, ANumber | |
6 from ppci.assembler import tokenize, Assembler, Lexer | 5 from ppci.assembler import tokenize, Assembler, Lexer |
7 from ppci.objectfile import ObjectFile | 6 from ppci.objectfile import ObjectFile |
8 from ppci.linker import Linker | 7 from ppci.linker import Linker |
9 from ppci.outstream import BinaryOutputStream | 8 from ppci.outstream import BinaryOutputStream |
10 from ppci.target.basetarget import Label | 9 from ppci.target.basetarget import Label |
34 with self.assertRaises(CompilerError): | 33 with self.assertRaises(CompilerError): |
35 list(tokenize(asmline, [])) | 34 list(tokenize(asmline, [])) |
36 | 35 |
37 | 36 |
38 class AssemblerParsingTestCase(unittest.TestCase): | 37 class AssemblerParsingTestCase(unittest.TestCase): |
39 """ | 38 """ |
40 Tests the assembler parts | 39 Tests the assembler parts |
41 """ | 40 """ |
42 def setUp(self): | 41 def setUp(self): |
43 self.skipTest('refactoring asm parser') | 42 self.skipTest('refactoring asm parser') |
44 self.parser = asmParser | 43 self.parser = asmParser |
103 | 102 |
104 | 103 |
105 class AsmTestCaseBase(unittest.TestCase): | 104 class AsmTestCaseBase(unittest.TestCase): |
106 """ Base testcase for assembly """ | 105 """ Base testcase for assembly """ |
107 def feed(self, line): | 106 def feed(self, line): |
108 self.a.assemble(line) | 107 self.a.assemble(line, self.ostream) |
109 | 108 |
110 def check(self, hexstr): | 109 def check(self, hexstr): |
111 l = Linker() | 110 l = Linker() |
112 self.obj = l.link([self.obj]) | 111 self.obj = l.link([self.obj]) |
113 data = bytes(self.obj.get_section('.text').data) | 112 data = bytes(self.obj.get_section('.text').data) |