def test_add_new_symbols_with_values(self): symbolTable = SymbolTable() symbolTable.add_symbol_with_value('first', 16) symbolTable.add_symbol_with_value('second', 17) self.assertEqual(symbolTable.get_symbol_value('first'), 16) self.assertEqual(symbolTable.get_symbol_value('second'), 17)
def test_symbols_collisions(self): symbolTable = SymbolTable() symbolTable.add_symbol_with_value('first', 16) symbolTable.add_symbol_with_value('second', 17) symbolTable.add_symbol('third') self.assertEqual(symbolTable.get_symbol_value('first'), 16) self.assertEqual(symbolTable.get_symbol_value('second'), 17) self.assertEqual(symbolTable.get_symbol_value('third'), 18)
def test_get_builtin_symbol(self): symbolTable = SymbolTable() self.assertEqual(symbolTable.get_symbol_value('R0'), 0)
def test_not_existing_symbol(self): symbolTable = SymbolTable() self.assertEqual(symbolTable.get_symbol_value('none'), None)