Opened 2 years ago

Closed 22 months ago

#29964 closed enhancement (fixed)

Make libs doctests ready for random seeds

Reported by: gh-kliem Owned by:
Priority: major Milestone: sage-9.3
Component: doctest framework Keywords:
Cc: Dave Morris Merged in:
Authors: Jonathan Kliem Reviewers: Marc Mezzarobba
Report Upstream: N/A Work issues:
Branch: 2995c47 (Commits, GitHub, GitLab) Commit: 2995c477d7c9eabc2744636e601427312d321d07
Dependencies: Stopgaps:

Status badges

Description (last modified by gh-kliem)

This ticket makes

sage -t --long --random-seed=n src/sage/libs/

pass for different values n than just 0.

Change History (14)

comment:1 Changed 2 years ago by gh-kliem

Description: modified (diff)

comment:2 Changed 2 years ago by gh-kliem

At least the following will need to be fixed:

sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/libs/flint/nmod_poly_linkage.pxi  # 28 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/libs/ntl/ntl_GF2E.pyx  # 1 doctest failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/libs/ntl/ntl_mat_GF2.pyx  # 29 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/libs/ntl/ntl_mat_GF2E.pyx  # 3 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/libs/ntl/ntl_mat_ZZ.pyx  # 1 doctest failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/libs/ntl/ntl_ZZ_p.pyx  # 1 doctest failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/libs/ntl/ntl_ZZ.pyx  # 3 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/libs/singular/function.pyx  # 1 doctest failed

comment:3 Changed 2 years ago by gh-kliem

Dependencies: #29962

comment:4 Changed 2 years ago by Matthias Köppe

Milestone: sage-9.2sage-9.3

comment:5 Changed 23 months ago by gh-kliem

The NTL function randomBits is documented incorrectly. Of course it returns a random number with n random bits which corresponds to a random number in [0, 2^n) and not 2^(n-1) as claimed.

comment:6 Changed 23 months ago by gh-kliem

Authors: Jonathan Kliem
Branch: public/29964
Cc: Dave Morris added
Commit: 080538b3c6a7d2c2a99d27c41d96ffad59d232fd
Status: newneeds_review

New commits:

080538bmake sage/libs ready for implicit fuzzing of doctests

comment:7 Changed 23 months ago by gh-kliem

Dependencies: #29962#29969
Status: needs_reviewneeds_work
list(mult for factor, mult in decomp) <= list(range(2, 2 + len(decomp)))

This does not test for a sublist. I will implement such a quick test in #29969.

comment:8 Changed 23 months ago by git

Commit: 080538b3c6a7d2c2a99d27c41d96ffad59d232fd6e02a466ca9635800b3659ba749ea477d1a18b9f

Branch pushed to git repo; I updated commit sha1. New commits:

6e02a46properly check if the list is strictly increasing

comment:9 Changed 23 months ago by gh-kliem

Dependencies: #29969
Status: needs_workneeds_review

comment:10 Changed 23 months ago by Marc Mezzarobba

Reviewers: Marc Mezzarobba

I think I would have kept the examples in gauss() (and flagged it as random), and maybe removed the test that the matrix is not reduced (no real point IMO). But that's not big deal: please feel free to set the ticket to positive_review on my behalf either after changing that or if you disagree.

comment:11 Changed 23 months ago by git

Commit: 6e02a466ca9635800b3659ba749ea477d1a18b9f2995c477d7c9eabc2744636e601427312d321d07

Branch pushed to git repo; I updated commit sha1. New commits:

2995c47keep a random doctest for illustration

comment:12 Changed 23 months ago by gh-kliem

Ok, I added again one of the examples of gauss for illustration.

The test that the matrix is not reduced really tests that the remaining rows are all zero, which tests that the functions has worked correctly, I guess.

comment:13 Changed 23 months ago by gh-kliem

Status: needs_reviewpositive_review

Thank you.

comment:14 Changed 22 months ago by Volker Braun

Branch: public/299642995c477d7c9eabc2744636e601427312d321d07
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.