Esempio n. 1
0
    def test_remove_redundant_branch_jumps_bne_j_false(self):
        arguments = [self.foo, \
                     S('command', 'bne', '$regA', '$regB', '$Lz'), \
                     S('command', 'j', '$Ly'), \
                     S('label', '$Lx'), \
                     self.bar]
        block = B(arguments)
        remove_redundant_branch_jumps(block)

        self.assertEquals(block.statements, arguments)
Esempio n. 2
0
    def test_remove_redundant_branch_jumps_bne_j_true(self):
        block = B([self.foo,
                   S('command', 'bne', '$regA', '$regB', '$Lx'),
                   S('command', 'j', '$Ly'),
                   S('label', '$Lx'),
                   self.bar])
        remove_redundant_branch_jumps(block)

        self.assertEquals(block.statements, [self.foo,
                   S('command', 'beq', '$regA', '$regB', '$Ly'),
                   S('label', '$Lx'),
                   self.bar])