Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gr: Add context methods #255

Merged
merged 6 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/flint/flintlib/types/gr.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ from flint.flintlib.types.flint cimport (
flint_bitcnt_t,
)

cdef extern from *:
"""
/*
* The following functions were introduced in FLINT 3.2.0
*/

#if __FLINT_RELEASE < 30200
#define gr_min(res, x, y, ctx) GR_UNABLE
#define gr_max(res, x, y, ctx) GR_UNABLE
#define gr_le(x, y, ctx) T_UNKNOWN
#define gr_lt(x, y, ctx) T_UNKNOWN
#define gr_ge(x, y, ctx) T_UNKNOWN
#define gr_gt(x, y, ctx) T_UNKNOWN
#define gr_abs_le(x, y, ctx) T_UNKNOWN
#define gr_abs_lt(x, y, ctx) T_UNKNOWN
#define gr_abs_ge(x, y, ctx) T_UNKNOWN
#define gr_abs_gt(x, y, ctx) T_UNKNOWN
#endif
"""


cdef extern from "flint/gr.h":

Expand Down
18 changes: 14 additions & 4 deletions src/flint/test/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

import flint

dunder_test_regex = re.compile(r'^(.*?)__test__\..*?\.(.*) \(line (\d+)\)$')
dunder_test_regex = re.compile(r'^(.*?)__test__\.(.*?\.)(.*) \(line (\d+)\)$')

test_flint_at_least = {
"flint.types._gr.gr_ctx.gens": 30100,
"flint.types._gr.gr_ctx.neg": 30100,
}


def find_doctests(module):
Expand All @@ -20,9 +25,14 @@ def find_doctests(module):
m = dunder_test_regex.match(test.name)
if m is not None:
groups = m.groups()
test.name = groups[0] + groups[1]
test.lineno = int(groups[2])
res.append(test)
test.name = groups[0] + groups[2]
test.lineno = int(groups[3])

if (
test_flint_at_least.get("".join(groups[:3]), flint.__FLINT_RELEASE__)
<= flint.__FLINT_RELEASE__
):
res.append(test)

tests.append((module_info.name, res))

Expand Down
Loading
Loading