Skip to content

Commit

Permalink
streamline test per reviewer feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
yyyyx4 committed Apr 14, 2023
1 parent 4c0995f commit faa5c0f
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/sage/quadratic_forms/binary_qf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1609,16 +1609,27 @@ def solve_integer(self, n, *, algorithm="general"):
Also when using the ``"cornacchia"`` algorithm::
sage: abc = [1,0,randrange(1,10^3)]
sage: Q = BinaryQF(abc)
sage: n = random_prime(10^9)
sage: if Q[2] % 4 == 3 and randrange(2):
....: n *= 4
sage: xy1 = Q.solve_integer(n, algorithm='cornacchia')
sage: xy1 is None or Q(*xy1) == n
sage: c = randrange(1, 10^3)
sage: Q1 = BinaryQF(1, 0, c)
sage: xy = Q1.solve_integer(n, algorithm='cornacchia')
sage: xy is None or Q1(*xy) == n
True
sage: (xy is None) == (Q1.solve_integer(n) is None)
True
sage: Q3 = BinaryQF(1, 0, 4*c+3)
sage: xy = Q3.solve_integer(n, algorithm='cornacchia')
sage: xy is None or Q3(*xy) == n
True
sage: (xy is None) == (Q3.solve_integer(n) is None)
True
sage: xy = Q3.solve_integer(4*n, algorithm='cornacchia')
sage: xy is None or Q3(*xy) == 4*n
True
sage: xy2 = Q.solve_integer(n)
sage: (xy1 is None) == (xy2 is None)
sage: (xy is None) == (Q3.solve_integer(4*n) is None)
True
Test for square discriminants specifically (:trac:`33026`)::
Expand Down

0 comments on commit faa5c0f

Please sign in to comment.