def test_chunks_numbers(self):
        """ Count all user allocations and free chunks"""
        # self.skipTest('notready')
        from haystack.structures.libc import ctypes_malloc as ctypes_alloc
        from haystack.structures.libc import libcheapwalker

        heaps = self.mappings.get_heaps()
        self.assertEquals(len(heaps), 1)

        heap = heaps[0]
        self.assertTrue(ctypes_alloc.is_malloc_heap(self.mappings, heap))

        walker = libcheapwalker.LibcHeapWalker(self.mappings, heap, 0)
        #
        allocs = walker.get_user_allocations()
        self.assertEquals(len(allocs), 2568)
        size = sum([size for addr, size in allocs])
        self.assertEquals(size, 105616)

        #
        free = walker.get_free_chunks()
        self.assertEquals(len(free), 7)
        size = sum([size for addr, size in free])
        self.assertEquals(size, 19252)

        return
    def test_ctypes6(self):
        from haystack.structures.libc import ctypes_malloc as ctypes_alloc
        from haystack.structures.libc import libcheapwalker

        heaps = self.mappings.get_heaps()
        self.assertEquals(len(heaps), 1)

        heap = heaps[0]
        self.assertTrue(ctypes_alloc.is_malloc_heap(self.mappings, heap))

        walker = libcheapwalker.LibcHeapWalker(self.mappings, heap, 0)
        # we should have 3 structures + 1 empty chunks
        allocs = walker.get_user_allocations()
        self.assertEquals(len(allocs), 3)

        # the empty chunk
        free = walker.get_free_chunks()
        self.assertEquals(len(free), 1)