Skip to content

Commit fc1ddc3

Browse files
committed
fix merge commits
2 parents d5052f0 + d63ed08 commit fc1ddc3

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Polynomials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ function setindex!(p::Poly, v, i)
197197
n = length(p.a)
198198
if n < i+1
199199
resize!(p.a,i+1)
200-
p.a[n:i] = 0
200+
p.a[n+1:i] = 0
201201
end
202202
p.a[i+1] = v
203203
v

test/runtests.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@ psum = p1 + p2 - p3
154154
@test truncate(Poly([2,1]),reltol=1,abstol=0) == Poly([0])
155155
@test truncate(Poly([2,1]),reltol=0,abstol=1) == Poly([2])
156156

157+
158+
## setindex!
159+
println("Test for setindex!()")
160+
p1 = Poly([1,2,1])
161+
p1[5] = 1
162+
@test p1[5] == 1
163+
@test p1 == Poly([1,2,1,0,0,1])
164+
165+
157166
## elementwise operations
158167
println("Test for element-wise operations")
159168
p1 = Poly([1, 2])
@@ -167,3 +176,4 @@ pmin = p-3
167176
@test isa(psum, Vector{Poly{Float64}})
168177
@test isa(pprod,Vector{Poly{Float64}})
169178
@test isa(pmin, Vector{Poly{Float64}})
179+

0 commit comments

Comments
 (0)