-
Notifications
You must be signed in to change notification settings - Fork 68
Fix edge-case in ConformanceTests.generate_element(::MPolyRing)
#2077
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
Fix edge-case in ConformanceTests.generate_element(::MPolyRing)
#2077
Conversation
@@ -1467,7 +1467,7 @@ function ConformanceTests.generate_element(Rx::MPolyRing) | |||
len_bound = 8 | |||
exp_bound = rand(1:5) | |||
len = rand(0:len_bound) | |||
coeffs = [ConformanceTests.generate_element(R) for _ in 1:len] | |||
coeffs = elem_type(R)[ConformanceTests.generate_element(R) for _ in 1:len] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of empty lists, this was of type Vector{Any}
despite the generation function being type stable. This caused more problems down the road.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2077 +/- ##
==========================================
- Coverage 88.39% 88.37% -0.02%
==========================================
Files 125 126 +1
Lines 31578 31639 +61
==========================================
+ Hits 27914 27962 +48
- Misses 3664 3677 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Any volunteers for approval? @thofma ? @lgoettgens ? |
Hm, maybe @fingolfin and @lgoettgens can comment? They worked on the interface tests and probably know if this was intended. |
docs/src/ring_interface.md
Outdated
@@ -505,6 +505,8 @@ throwing an exception, returning meaningless results, hanging or crashing. The | |||
function should only be called with `check=false` if it is already known that the | |||
division will be exact. | |||
|
|||
***Note:*** For the *recursive* ring tests to work, one needs to also implement `divides(f::MyElem, g::MyElem)`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think divides
is only required for euclidean rings: only test_EuclideanRing_interface
calls it. Which is in turn only invoked automatically for univariate polynomial rings over a field...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And there are generic divides
methods for that, i.e.:
divides(f::PolyRingElem{T}, g::PolyRingElem{T}) where T <: RingElement
divides(z::PolyRingElem{T}, x::T) where T <: RingElement
So it would be really good to know what the actual problem you run into was?
This was the backtrace leading to the problem (taking from Slack):
|
So this started with As a recursive test was requested it then went to test mpoly rings over the given monoid algebra, i.e.: which then calls And that test then ends up doing:
This eventually triggers a call to and so on. So how to handle this. Some option:
For 3 one possible way forward would be via the |
All that said, I really don't want |
Not clear what the "ring interface" promises. "If you implement these methods for your ring type, then the recursive tests will pass (modulo bugs in your code)"? I am happy to try out 3). If this is not an option (because of time reasons), what about hiding the test behind a |
This reverts commit 7f6d41f.
ConformanceTests.generate_element(::MPolyRing)
I updated this in view of #2096 . Now it does not contain changes to the docu anymore. |
ConformanceTests.generate_element(::MPolyRing)
ConformanceTests.generate_element(::MPolyRing)
It turns out that for the recursive ring interface tests one actually needs to implement
divides
. We should mention that in the documentation of the ring interface.