@@ -0,0 +1,1003 @@
+import nose%0Aimport cle%0Aimport os%0A%0Aclass MockBackend(cle.backends.Backend):%0A    def __init__(self, requested_base, size, **kwargs):%0A        super(MockBackend, self).__init__('/dev/zero', **kwargs)%0A        self.requested_base = requested_base%0A        self.size = size%0A%0A    def get_max_addr(self):%0A        return self.rebase_addr + self.size%0A%0Adef test_overlap():%0A    filename = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries/tests/i386/manysum')%0A    ld = cle.Loader(filename, auto_load_libs=False)%0A    nose.tools.assert_equal(ld.main_bin.rebase_addr, 0)%0A    nose.tools.assert_equal(ld.main_bin.get_min_addr(), 0x8048000)%0A%0A    obj1 = MockBackend(0x8047000, 0x2000, custom_arch=ld.main_bin.arch)%0A    obj2 = MockBackend(0x8047000, 0x1000, custom_arch=ld.main_bin.arch)%0A%0A    ld.add_object(obj1)%0A    ld.add_object(obj2)%0A%0A    nose.tools.assert_equal(obj2.rebase_addr, 0x8047000)%0A    nose.tools.assert_greater(obj1.rebase_addr, 0x8048000)%0A%0Aif __name__ == '__main__':%0A    test_overlap()%0A

Add test case for object overlapping and requested base addresses