Skip to content

Commit cb0c65e

Browse files
committed
A few missing tests
1 parent c2eeace commit cb0c65e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/runtests.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ sprint(show, pNULL)
4848

4949
@test map(degree, [pNULL,p0,p1,p2,p3,p4,p5,pN,pR,p1000]) == [0,0,0,1,2,3,4,4,2,999]
5050

51+
@test polyval(poly(Int[]), 2.) == 1.
5152
@test polyval(pN, -.125) == 276.9609375
5253
@test polyval(pNULL, 10) == 0
5354
@test polyval(p0, -10) == 0
@@ -69,6 +70,7 @@ sprint(show, pNULL)
6970

7071
@test poly([-1,-1]) == p3
7172
@test roots(p0)==roots(p1)==roots(pNULL)==[]
73+
@test roots(Poly([0,1,0])) == [0.]
7274
@test roots(p2) == [-1]
7375
a_roots = copy(pN.a)
7476
@test all(map(abs,sort(roots(poly(a_roots))) - sort(a_roots)) .< 1e6)
@@ -181,6 +183,8 @@ p1[5] = 1
181183

182184
p1[:] = 0
183185
@test p1 zero(p1)
186+
@test zero(Poly{Int}) == Poly(Int[])
187+
@test one(Poly{Int}) == Poly([1])
184188
p1[:] = [1,2,1,0,0,1]
185189
@test p1 == Poly([1,2,1,0,0,1])
186190

@@ -307,6 +311,9 @@ pint = polyint(p)
307311
@test isequal(pder, Poly([NaN])) # derivative will give Poly([NaN])
308312
@test isequal(pint, Poly([NaN])) # integral will give Poly([NaN])
309313

314+
pint = polyint(p, Complex(0.))
315+
@test isequal(pint, Poly([NaN])) # integral will give Poly([NaN])
316+
310317
## proper conversions in arithmetic with different element-types #94
311318
p = Poly([0,one(Float64)])
312319
@test Poly{Complex{Float64}} == typeof(p+1im)

0 commit comments

Comments
 (0)