Mercurial > lcfOS
diff test/testasm.py @ 318:e84047f29c78
Add burg and yacc initial attempts
author | Windel Bouwman |
---|---|
date | Tue, 31 Dec 2013 12:38:15 +0100 |
parents | 534b94b40aa8 |
children | 6f4753202b9a |
line wrap: on
line diff
--- a/test/testasm.py Sun Dec 22 15:50:59 2013 +0100 +++ b/test/testasm.py Tue Dec 31 12:38:15 2013 +0100 @@ -13,20 +13,20 @@ def testLex0(self): """ Check if the lexer is OK """ - asmline, toks = 'mov rax, rbx ', ['ID', 'ID', ',', 'ID'] + asmline, toks = 'mov rax, rbx ', ['ID', 'ID', ',', 'ID', 'EOF'] self.assertSequenceEqual([tok.typ for tok in tokenize(asmline)], toks) def testLex1(self): """ Test if lexer correctly maps some tokens """ - asmline, toks = 'lab1: mov rax, rbx ', ['ID', ':', 'ID', 'ID', ',', 'ID'] - self.assertSequenceEqual([tok.typ for tok in tokenize(asmline)], toks) - - def testLex1(self): - """ Test if lexer correctly maps some tokens """ - asmline, toks = 'mov 3.13 0xC 13', ['ID', 'REAL', 'NUMBER', 'NUMBER'] + asmline, toks = 'lab1: mov rax, rbx ', ['ID', ':', 'ID', 'ID', ',', 'ID', 'EOF'] self.assertSequenceEqual([tok.typ for tok in tokenize(asmline)], toks) def testLex2(self): + """ Test if lexer correctly maps some tokens """ + asmline, toks = 'mov 3.13 0xC 13', ['ID', 'REAL', 'NUMBER', 'NUMBER', 'EOF'] + self.assertSequenceEqual([tok.typ for tok in tokenize(asmline)], toks) + + def testLex3(self): """ Test if lexer fails on a token that is invalid """ asmline = '0z4: mov rax, rbx $ ' with self.assertRaises(CompilerError): @@ -81,7 +81,7 @@ def testParse6(self): # A line can be empty self.a.parse_line('') - + class AssemblerOtherTestCase(unittest.TestCase): def testWithoutTarget(self):