def testCPUB(self): session = Session() session.parse_args(["--platform=NES", "--cpu=2A07"]) session.initialize_target() self.assertIsInstance(session._target, NES) self.assertEqual(session._target._cpu, "2a07") Types._shared_state = {}
def testMultipleFiles(self): session = Session() session.parse_args(["--cpu=6502", "bar.s", "foo.s"]) self.assertIsInstance(session.get_args(), list) self.assertEquals(session.get_args()[0], "bar.s") self.assertEquals(session.get_args()[1], "foo.s") Types._shared_state = {}
def testGeneric6502Platform(self): session = Session() session.parse_args(["--cpu=6502"]) session.initialize_target() self.assertIsInstance(session._target, Generic) self.assertEqual(session._target._cpu, "6502") Types._shared_state = {}
def reset_block(self): root_file = Session().get_root_file() if root_file not in self._blocks: self._blocks[root_file] = [] self._blocks[root_file].append(self._block) self._init_block()
def testGeneric6502Platform(self): session = Session() session.parse_args(['--cpu=6502']) session.initialize_target() self.assertIsInstance(session._target, Generic) self.assertEqual(session._target._cpu, '6502') Types._shared_state = {}
def testCPUB(self): session = Session() session.parse_args(['--platform=NES', '--cpu=2A07']) session.initialize_target() self.assertIsInstance(session._target, NES) self.assertEqual(session._target._cpu, '2a07') Types._shared_state = {}
def testMultipleFiles(self): session = Session() session.parse_args(['--cpu=6502', 'bar.s', 'foo.s']) self.assertIsInstance(session.get_args(), list) self.assertEquals(session.get_args()[0], 'bar.s') self.assertEquals(session.get_args()[1], 'foo.s') Types._shared_state = {}
def p_nes_pp_ines_statement(self, p): '''nes_pp_ines_statement : PPINESOFF NL | PPINESMAPPER nes_pp_value NL | PPINESMIRRORING nes_pp_value NL | PPINESFOURSCREEN nes_pp_value NL | PPINESBATTERY nes_pp_value NL | PPINESTRAINER nes_pp_value NL | PPINESPRGREPEAT nes_pp_value NL | PPINESCHRREPEAT nes_pp_value NL''' value = None if len(p) == 3: value = True else: # strip quotes off if they exist value = self._clean_value(p[2]) # store the ines setting in the target Session().get_target()[p[1]] = value
def __init__(self, cpu=None): if not cpu: raise CommandLineError("no CPU specified for generic platform") super(Generic, self).__init__() self._cpu = cpu cpu_spec = Session().get_cpu_spec(cpu) if not cpu_spec: raise CommandLineError("unknown CPU type: %s" % cpu) # get the platform data cpu_class = cpu_spec['class'] cpu_module = 'hlakit.' + cpu_spec['module'] cpu_symbols = __import__(cpu_module, fromlist=[cpu_class]) cpu_ctor = getattr(cpu_symbols, cpu_class) # initialize the target self._cpu_obj = cpu_ctor()
def p_error(self, p): if p != None: print "Syntax error in input! File: %s, Line: %s" % ( Session().get_cur_file(), p.lineno) import pdb pdb.set_trace()
def testDrawShort(self): session = Session() session.parse_args(['--cpu=6502', '-d']) self.assertTrue(session.is_graph()) Types._shared_state = {}
def testDebugShort(self): session = Session() session.parse_args(['--cpu=6502', '-g']) self.assertTrue(session.is_debug()) Types._shared_state = {}
def testBogusPlatform(self): session = Session() self.assertRaises(CommandLineError, session.parse_args, ['--platform=blah']) Types._shared_state = {}
def testNoParameters(self): session = Session() self.assertRaises(CommandLineError, session.parse_args, []) Types._shared_state = {}
def testIncludeShort(self): session = Session() session.parse_args(['--cpu=6502', '-Itests']) self.assertIsInstance(session.get_include_dirs(), list) self.assertEquals(session.get_include_dirs(), ['tests']) Types._shared_state = {}
def start_block(self, type_=None): self._block['type'] = type_ self._block['started'] = True self._block['banksize'] = self._banksize[type_] self._block['source'] = copy.copy(Session()._cur_file)
def testDrawShort(self): session = Session() session.parse_args(["--cpu=6502", "-d"]) self.assertTrue(session.is_graph()) Types._shared_state = {}
def testDebugShort(self): session = Session() session.parse_args(["--cpu=6502", "-g"]) self.assertTrue(session.is_debug()) Types._shared_state = {}
def testIncludeShort(self): session = Session() session.parse_args(["--cpu=6502", "-Itests"]) self.assertIsInstance(session.get_include_dirs(), list) self.assertEquals(session.get_include_dirs(), ["tests"]) Types._shared_state = {}