Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
simplify doctest in list_of_faces
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Kliem committed Sep 2, 2020
1 parent 3e30d07 commit 41ed120
Showing 1 changed file with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <size_t> 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()
"""
Expand All @@ -221,6 +202,26 @@ cdef class ListOfFaces:
self.data[i] = <uint64_t *> \
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 = <size_t> self.data[i]
assert address == address & ~(required_alignment - 1)

def __copy__(self):
r"""
Return a copy of self.
Expand Down

0 comments on commit 41ed120

Please sign in to comment.