def METHOD_NAME(self, arch, filename, segments):
    binary_path = os.path.join(TESTS_BASE, arch, filename)
    ld = cle.Loader(binary_path, auto_load_libs=False)
    self.assertEqual(len(ld.main_object.segments), len(segments))
    for i, segment in enumerate(ld.main_object.segments):
        self.assertEqual(segment.offset, segments[i].offset)
        self.assertEqual(segment.vaddr, segments[i].vaddr)
        self.assertEqual(segment.memsize, segments[i].memsize)
        self.assertEqual(segment.filesize, segments[i].filesize)
    # address lookups
    self.assertIsNone(ld.main_object.segments.find_region_containing(-1))
    # skip all segments that are not mapped into memory
    mapped_segments = [segment for segment in segments if segment.vaddr != 0]
    for segment in mapped_segments:
        self.assertEqual(
            ld.main_object.find_segment_containing(segment.vaddr).vaddr,
            segment.vaddr,
        )
        self.assertEqual(
            ld.main_object.segments.find_region_containing(segment.vaddr).vaddr,
            segment.vaddr,
        )
        if segment.memsize > 0:
            self.assertEqual(
                ld.main_object.find_segment_containing(segment.vaddr + 1).vaddr,
                segment.vaddr,
            )
            self.assertEqual(
                ld.main_object.segments.find_region_containing(segment.vaddr + 1).vaddr,
                segment.vaddr,
            )
            self.assertEqual(
                ld.main_object.find_segment_containing(segment.vaddr + segment.memsize - 1).vaddr,
                segment.vaddr,
            )
            self.assertEqual(
                ld.main_object.segments.find_region_containing(segment.vaddr + segment.memsize - 1).vaddr,
                segment.vaddr,
            )
    for i in range(len(mapped_segments) - 1):
        seg_a, seg_b = mapped_segments[i], mapped_segments[i + 1]
        if seg_a.vaddr + seg_a.memsize < seg_b.vaddr:
            # there is a gap between seg_a and seg_b
            for j in range(min(seg_b.vaddr - (seg_a.vaddr + seg_a.memsize), 20)):
                a = seg_a.vaddr + seg_a.memsize + j
                self.assertIsNone(ld.main_object.find_segment_containing(a))
                self.assertIsNone(ld.main_object.segments.find_region_containing(a))
    self.assertIsNone(ld.main_object.find_segment_containing(0xFFFFFFFF), None)