Пример #1
0
 def test_destNoDest(self):
     """ Return the dest mnemonic for a C command - this case has no dest mnemonic - should return None"""
     testParser = Parser(
         '/Users/Sean/Desktop/nand2tetris/projects/06/max/MaxL.asm')
     testParser.advance()
     testParser.advance()
     testParser.advance()
     testParser.advance()
     testParser.advance()
     self.assertEqual(testParser.dest(), 'None')
 def test_dest(self):
     file_path = './add/Add.asm'
     test_parser = Parser(file_path)
     test_parser.process_file()
     test_parser.advance()
     self.assertEqual(test_parser.dest(), None)
     test_parser.advance()
     self.assertEqual(test_parser.dest(), 'D')
     test_parser.advance()
     self.assertEqual(test_parser.dest(), None)
     test_parser.advance()
     self.assertEqual(test_parser.dest(), 'D')
     test_parser.advance()
     self.assertEqual(test_parser.dest(), None)
     test_parser.advance()
     self.assertEqual(test_parser.dest(), 'M')
Пример #3
0
 def test_dest(self):
     """ Return the dest mnemonic for a C command"""
     testParser = Parser(
         '/Users/Sean/Desktop/nand2tetris/projects/06/max/MaxL.asm')
     testParser.advance()
     self.assertEqual(testParser.dest(), 'D')