Skip to content

Commit 5c8f244

Browse files
authored
test using float over a polynomial (#604)
1 parent c8f177d commit 5c8f244

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/common.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,6 @@ function Base.map(fn, p::P, args...) where {P<:AbstractPolynomial}
647647
return (P){R,X}(xs)
648648
end
649649

650-
651650
"""
652651
isreal(p::AbstractPolynomial)
653652

test/StandardBasis.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,23 @@ end
11951195
end
11961196
end
11971197

1198+
@testset "map/any/all" begin
1199+
# map over a polynomial and return a polynomial
1200+
p = Polynomial([1,2,3])
1201+
pp = map(float,p)
1202+
@test !(eltype(p) <: AbstractFloat)
1203+
@test eltype(pp) <: AbstractFloat
1204+
@test pp p
1205+
@test all(isinteger, p)
1206+
@test any(>=(2), p)
1207+
1208+
p = Polynomial([im, 2, 3])
1209+
q = Polynomial([0,2,3])
1210+
@test map(real, p) == q
1211+
1212+
v = [1,2,3]
1213+
@test map(sin, Polynomial(v)) == Polynomial(sin.(v))
1214+
end
11981215

11991216
@testset "As matrix elements" begin
12001217

0 commit comments

Comments
 (0)