comparison test/testasm.py @ 290:7b38782ed496

File moves
author Windel Bouwman
date Sun, 24 Nov 2013 11:24:15 +0100
parents 05184b95fa16
children 534b94b40aa8
comparison
equal deleted inserted replaced
289:bd2593de3ff8 290:7b38782ed496
2 2
3 import unittest, cProfile 3 import unittest, cProfile
4 from ppci import CompilerError 4 from ppci import CompilerError
5 from asmnodes import AInstruction, ABinop, AUnop, ASymbol, ALabel, ANumber 5 from asmnodes import AInstruction, ABinop, AUnop, ASymbol, ALabel, ANumber
6 from asm import tokenize, Assembler 6 from asm import tokenize, Assembler
7 import msp430 7 import target.armtarget as arm
8 import cortexm3 as arm
9 import outstream 8 import outstream
10 from target import Label 9 from target import Label
10
11 11
12 class AssemblerLexingCase(unittest.TestCase): 12 class AssemblerLexingCase(unittest.TestCase):
13 """ Tests the assemblers lexer """ 13 """ Tests the assemblers lexer """
14 14
15 def testLex0(self): 15 def testLex0(self):
30 def testLex2(self): 30 def testLex2(self):
31 """ Test if lexer fails on a token that is invalid """ 31 """ Test if lexer fails on a token that is invalid """
32 asmline = '0z4: mov rax, rbx $ ' 32 asmline = '0z4: mov rax, rbx $ '
33 with self.assertRaises(CompilerError): 33 with self.assertRaises(CompilerError):
34 list(tokenize(asmline)) 34 list(tokenize(asmline))
35
35 36
36 class AssemblerParsingTestCase(unittest.TestCase): 37 class AssemblerParsingTestCase(unittest.TestCase):
37 """ 38 """
38 Tests the assembler parts 39 Tests the assembler parts
39 """ 40 """
311 self.feed('bne henkie') 312 self.feed('bne henkie')
312 self.feed('b henkie') 313 self.feed('b henkie')
313 self.check('32b41519 94420198 049332bc a340ab42 f6d0f5d1 f4e7') 314 self.check('32b41519 94420198 049332bc a340ab42 f6d0f5d1 f4e7')
314 315
315 if __name__ == '__main__': 316 if __name__ == '__main__':
316 #cProfile.run('unittest.main()')
317 unittest.main() 317 unittest.main()
318