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)
Ejemplo 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])
Ejemplo 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)
Ejemplo 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_isolate_incbins(self):
     asm = ["123", "456", "789", "abc", "def", "ghi",
            'INCBIN "baserom.gbc",$12DA,$12F8 - $12DA',
            "jkl",
            'INCBIN "baserom.gbc",$137A,$13D0 - $137A']
     lines = isolate_incbins(asm=asm)
     self.assertIn(asm[6], lines)
     self.assertIn(asm[8], lines)
     for line in lines:
         self.assertIn("baserom", line)
Ejemplo n.º 8
0
 def test_isolate_incbins(self):
     asm = [
         "123", "456", "789", "abc", "def", "ghi",
         'INCBIN "baserom.gbc",$12DA,$12F8 - $12DA', "jkl",
         'INCBIN "baserom.gbc",$137A,$13D0 - $137A'
     ]
     lines = isolate_incbins(asm=asm)
     self.assertIn(asm[6], lines)
     self.assertIn(asm[8], lines)
     for line in lines:
         self.assertIn("baserom", line)