Skip to content

Commit cb5069c

Browse files
committed
Add tests for mutability of output of zero/one
1 parent 0671d06 commit cb5069c

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ MutableArithmetics = "d8a4904e-b15c-11e9-3269-09a3773c0cb0"
1111

1212
[compat]
1313
DataStructures = "0.17.7"
14-
DynamicPolynomials = "0.3.11"
14+
DynamicPolynomials = "0.3.12"
1515
MutableArithmetics = "0.2"
1616
TypedPolynomials = "0.2.8"
1717
julia = "1"

test/division.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ const MP = MultivariatePolynomials
6969
@test q == [x, 0]
7070
@test r == 0
7171

72+
@testset "Issue DynamicPolynomials#62" begin
73+
p = x^2 + x + 1
74+
q = rem(p, [x^2-y])
75+
@test q == x + y + 1
76+
end
77+
7278
@test (@inferred rem(x^2*y + (1+1e-10)*x*y + 1, [x^2 + x, y + 1])) == 1
7379
@test (@inferred rem(x^2*y + (1+1e-10)*x*y + 1, [x^2 + x, y + 1]; ztol=1e-11)) == -((1+1e-10)-1)x + 1
7480
end

test/polynomial.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,11 @@ const MP = MultivariatePolynomials
173173
p = im * x + 2im * x^2
174174
@test p * p == -x^2 - 4x^4 - 4x^3
175175
end
176+
177+
@testset "$f is a mutable copy, see issue DynamicPolynomials#62" for f in [zero, one]
178+
p = 2x + 1
179+
q = f(p)
180+
q = MA.add!(q, 2y)
181+
@test p == 2x + 1
182+
end
176183
end

0 commit comments

Comments
 (0)