def test_find_incbin_to_replace_for(self):
     global asm, incbin_lines, processed_incbins
     asm = ['first line', 'second line', 'third line',
            'INCBIN "baserom.gbc",$90,$200 - $90',
            'fifth line', 'last line']
     isolate_incbins()
     process_incbins()
     line_num = find_incbin_to_replace_for(0x100)
     # must be the 4th line (the INBIN line)
     self.assertEqual(line_num, 3)
 def test_split_incbin_line_into_three(self):
     global asm, incbin_lines, processed_incbins
     asm = ['first line', 'second line', 'third line',
            'INCBIN "baserom.gbc",$90,$200 - $90',
            'fifth line', 'last line']
     isolate_incbins()
     process_incbins()
     content = split_incbin_line_into_three(3, 0x100, 10)
     # must end up with three INCBINs in output
     self.failUnless(content.count("INCBIN") == 3)
Exemplo n.º 3
0
 def test_find_incbin_to_replace_for(self):
     global asm, incbin_lines, processed_incbins
     asm = [
         'first line', 'second line', 'third line',
         'INCBIN "baserom.gbc",$90,$200 - $90', 'fifth line', 'last line'
     ]
     isolate_incbins(asm=asm)
     process_incbins()
     line_num = find_incbin_to_replace_for(0x100)
     # must be the 4th line (the INBIN line)
     self.assertEqual(line_num, 3)
 def test_analyze_intervals(self):
     global asm, incbin_lines, processed_incbins
     asm, incbin_lines, processed_incbins = None, [], {}
     asm = ['first line', 'second line', 'third line',
            'INCBIN "baserom.gbc",$90,$200 - $90',
            'fifth line', 'last line',
            'INCBIN "baserom.gbc",$33F,$4000 - $33F']
     isolate_incbins()
     process_incbins()
     largest = analyze_intervals()
     self.assertEqual(largest[0]["line_number"], 6)
     self.assertEqual(largest[0]["line"], asm[6])
     self.assertEqual(largest[1]["line_number"], 3)
     self.assertEqual(largest[1]["line"], asm[3])
Exemplo n.º 5
0
    def test_split_incbin_line_into_three(self, mock_os_lstat):
        global asm, incbin_lines, processed_incbins

        mock_os_lstat.return_value.st_size = 0x10000

        asm = [
            'first line', 'second line', 'third line',
            'INCBIN "baserom.gbc",$90,$200 - $90', 'fifth line', 'last line'
        ]
        isolate_incbins(asm=asm)
        process_incbins()
        content = split_incbin_line_into_three(3, 0x100, 10)
        # must end up with three INCBINs in output
        self.failUnless(content.count("INCBIN") == 3)
Exemplo n.º 6
0
 def test_analyze_intervals(self):
     global asm, incbin_lines, processed_incbins
     asm, incbin_lines, processed_incbins = None, [], {}
     asm = [
         'first line', 'second line', 'third line',
         'INCBIN "baserom.gbc",$90,$200 - $90', 'fifth line', 'last line',
         'INCBIN "baserom.gbc",$33F,$4000 - $33F'
     ]
     isolate_incbins(asm=asm)
     process_incbins()
     largest = analyze_intervals()
     self.assertEqual(largest[0]["line_number"], 6)
     self.assertEqual(largest[0]["line"], asm[6])
     self.assertEqual(largest[1]["line_number"], 3)
     self.assertEqual(largest[1]["line"], asm[3])
 def test_process_incbins(self):
     global incbin_lines, processed_incbins, asm
     incbin_lines = ['INCBIN "baserom.gbc",$12DA,$12F8 - $12DA',
                     'INCBIN "baserom.gbc",$137A,$13D0 - $137A']
     asm = copy(incbin_lines)
     asm.insert(1, "some other random line")
     processed_incbins = process_incbins()
     self.assertEqual(len(processed_incbins), len(incbin_lines))
     self.assertEqual(processed_incbins[0]["line"], incbin_lines[0])
     self.assertEqual(processed_incbins[2]["line"], incbin_lines[1])
Exemplo n.º 8
0
 def test_process_incbins(self):
     global incbin_lines, processed_incbins, asm
     incbin_lines = [
         'INCBIN "baserom.gbc",$12DA,$12F8 - $12DA',
         'INCBIN "baserom.gbc",$137A,$13D0 - $137A'
     ]
     asm = copy(incbin_lines)
     asm.insert(1, "some other random line")
     processed_incbins = process_incbins()
     self.assertEqual(len(processed_incbins), len(incbin_lines))
     self.assertEqual(processed_incbins[0]["line"], incbin_lines[0])
     self.assertEqual(processed_incbins[2]["line"], incbin_lines[1])