diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx index f56bfe346ca..c9fe3e80991 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx @@ -176,26 +176,7 @@ cdef class ListOfFaces: See :class:`ListOfFaces`. - TESTS: - - Checking for correct alignment of the data:: - - sage: cython(''' - ....: from libc.stdint cimport uint64_t - ....: from sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces \ - ....: cimport ListOfFaces - ....: - ....: cdef ListOfFaces facets - ....: cdef size_t address - ....: cdef size_t required_alignment - ....: - ....: facets = ListOfFaces(10, 13) - ....: required_alignment = facets.face_length*8 - ....: for i in range(10): - ....: address = facets.data[i] - ....: if not address == address & ~(required_alignment - 1): - ....: print('Alignment not correct') - ....: ''') + TESTS:: sage: TestSuite(sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces).run() """ @@ -221,6 +202,26 @@ cdef class ListOfFaces: self.data[i] = \ self._mem.aligned_malloc(chunksize//8, self.face_length*8) + def _test_alignment(self): + r""" + Check the correct alignment. + + TESTS:: + + sage: from sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces \ + ....: import ListOfFaces + sage: facets = ListOfFaces(10, 13) + sage: facets._test_alignment() + """ + cdef size_t address + cdef size_t required_alignment + cdef size_t i + + required_alignment = chunksize/8 + for i in range(self.n_faces): + address = self.data[i] + assert address == address & ~(required_alignment - 1) + def __copy__(self): r""" Return a copy of self.