Mercurial > lcfOS
diff test/testasm.py @ 335:582a1aaa3983
Added long branch format
author | Windel Bouwman |
---|---|
date | Mon, 17 Feb 2014 20:41:30 +0100 |
parents | 6f4753202b9a |
children | b00219172a42 |
line wrap: on
line diff
--- a/test/testasm.py Thu Feb 13 22:02:08 2014 +0100 +++ b/test/testasm.py Mon Feb 17 20:41:30 2014 +0100 @@ -4,6 +4,8 @@ from ppci import CompilerError from ppci.asmnodes import AInstruction, ABinop, AUnop, ASymbol, ALabel, ANumber from ppci.assembler import tokenize, Assembler +from ppci.objectfile import ObjectFile +from ppci.linker import Linker import outstream from target import Label @@ -92,10 +94,11 @@ class OustreamTestCase(unittest.TestCase): def test1(self): - o = outstream.BinOutputStream() + obj = ObjectFile() + o = outstream.BinaryOutputStream(obj) o.selectSection('.text') o.emit(Label('a')) - self.assertSequenceEqual(bytes(), o.Data) + self.assertSequenceEqual(bytes(), obj.get_section('.text').data) class AsmTestCaseBase(unittest.TestCase): @@ -104,7 +107,10 @@ self.a.assemble(line) def check(self, hexstr): - self.assertSequenceEqual(bytes.fromhex(hexstr), self.o.Data) + l = Linker() + self.obj = l.link([self.obj]) + data = bytes(self.obj.get_section('.text').data) + self.assertSequenceEqual(bytes.fromhex(hexstr), data) if __name__ == '__main__':