Skip to content

Commit 74a1c1e

Browse files
committed
add back in tests
1 parent d576221 commit 74a1c1e

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

src/contrib.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ end
2525
end
2626
return out
2727
end
28-
end
28+
end
29+
30+
##

src/polynomials/ChebyshevT.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ function derivative(p::ChebyshevT{T}, order::Integer) where {T}
130130
return ChebyshevT(der, p.var)
131131
end
132132

133-
##
134133
function companion(p::ChebyshevT{T}) where T
135134
d = length(p) - 1
136135
d < 1 && error("Series must have degree greater than 1")

test/ChebyshevT.jl

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ end
4747

4848
@testset "Roots $i" for i in 1:5
4949
roots = cos.(range(-π, 0, length = 2i + 1)[2:2:end])
50-
target = ChebyshevT(push!(zeros(i), 1))
50+
target = ChebyshevT(vcat(zeros(i), 1))
5151
res = fromroots(ChebyshevT, roots) .* 2^(i - 1)
5252
@test res == target
5353
end
@@ -77,7 +77,7 @@ end
7777
@test_throws ErrorException companion(c_null)
7878
@test_throws ErrorException companion(c_1)
7979
for i in 1:5
80-
coef = push!(zeros(i), 1)
80+
coef = vcat(zeros(i), 1)
8181
c = ChebyshevT(coef)
8282
@test size(companion(c)) == (i, i)
8383
end
@@ -90,7 +90,7 @@ end
9090
v = vander(ChebyshevT, x, 5)
9191
@test size(v) == (length(x), 6)
9292
@inbounds for i in eachindex(x)
93-
coef = push!(zeros(i - 1), 1)
93+
coef = vcat(zeros(i - 1), 1)
9494
c = ChebyshevT(coef)
9595
@test v[:, i] c.(x)
9696
end
@@ -101,8 +101,8 @@ end
101101
target = zeros(i + j + 1)
102102
target[end] += 0.5
103103
target[abs(i - j) + 1] += 0.5
104-
c1 = ChebyshevT(push!(zeros(i), 1))
105-
c2 = ChebyshevT(push!(zeros(j), 1))
104+
c1 = ChebyshevT(vcat(zeros(i), 1))
105+
c2 = ChebyshevT(vcat(zeros(j), 1))
106106
@test c1 * c2 ChebyshevT(target)
107107

108108
# divrem
@@ -121,13 +121,14 @@ end
121121
c1 = ChebyshevT([1, 2, 3])
122122
c2 = ChebyshevT([3, 2, 1])
123123
d, r = divrem(c1, c2)
124-
@test coeffs(d) [3]
125-
@test coeffs(r) [-8, -4]
124+
@test d.coeffs [3]
125+
@test r.coeffs [-8, -4]
126126

127127
c2 = ChebyshevT([0, 1, 2, 3])
128128
d, r = divrem(c2, c1)
129-
@test coeffs(d) [0, 2]
130-
@test coeffs(r) [-2, -4]
129+
130+
@test d.coeffs [0, 2]
131+
@test r.coeffs [-2, -4]
131132

132133

133134
# GCD
@@ -145,20 +146,20 @@ end
145146

146147
for i in 0:4
147148
scl = i + 1
148-
p = Polynomial(push!(zeros(i), 1))
149-
target = Polynomial(push!(append!(Float64[i], zeros(i)), 1 / scl))
149+
p = Polynomial(vcat(zeros(i), 1))
150+
target = Polynomial(vcat(i, zeros(i), 1 / scl))
150151
cheb = convert(ChebyshevT, p)
151152
cint = integral(cheb, i)
152153
res = convert(Polynomial, cint)
153154
@test res target
154155
@test derivative(cint) == cheb
155156
end
156157
end
157-
158+
@info ""
158159
@testset "z-series" for i in 0:5
159160
# c to z
160-
input = append!([2], ones(i))
161-
target = append!(push!(0.5 .* ones(i), 2), 0.5 .* ones(i))
161+
input = vcat(2, ones(i))
162+
target = vcat(0.5 .* ones(i), 2, 0.5 .* ones(i))
162163
zs = Polynomials._c_to_z(input)
163164
@test zs == target
164165
c = Polynomials._z_to_c(zs)

test/runtests.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using RecipesBase: apply_recipe
77

88
import SparseArrays: sparse, nnz
99

10-
# @testset "Polynomial" begin include("Polynomial.jl") end
10+
@testset "Polynomial" begin include("Polynomial.jl") end
1111
@testset "ChebyshevT" begin include("ChebyshevT.jl") end
12-
# @testset "Deprecations" begin include("deprecated.jl") end
13-
# @testset "Poly (deprecaterd)" begin include("Poly.jl") end
12+
@testset "Deprecations" begin include("deprecated.jl") end
13+
@testset "Poly (deprecaterd)" begin include("Poly.jl") end

0 commit comments

Comments
 (0)