Skip to content

Commit 1cc65c4

Browse files
authored
move show methods from ApproxFun (#42)
* move show methods from ApproxFun * change version to v0.3.0 * occursin instead of contains
1 parent a8e25a8 commit 1cc65c4

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunFourier"
22
uuid = "59844689-9c9d-51bf-9583-5b794ec66d30"
3-
version = "0.2.15"
3+
version = "0.3.0"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/ApproxFunFourier.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,5 +647,19 @@ function Fun(T::ToeplitzOperator)
647647
end
648648
end
649649

650+
Base.show(io::IO,d::Circle) =
651+
print(io,(d.radius==1 ? "" : string(d.radius))*
652+
(d.orientation ? "🕒" : "🕞")*
653+
(d.center==0 ? "" : "+$(d.center)"))
654+
655+
Base.show(io::IO, d::PeriodicSegment) = print(io,"$(leftendpoint(d)),$(rightendpoint(d))")
656+
for typ in (:Fourier, :Laurent, :Taylor, :SinSpace, :CosSpace)
657+
typstr = string(typ)
658+
@eval function Base.show(io::IO, S::$typ)
659+
print(io, $typstr, "(")
660+
show(io, domain(S))
661+
print(io, ")")
662+
end
663+
end
650664

651665
end #module

test/runtests.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,3 +597,17 @@ end
597597
f=Fun(z->2exp(z^2),PeriodicLine(0./2))
598598
@test f(1.1im) 2exp(-1.1^2)
599599
end
600+
601+
@testset "show" begin
602+
for (spT, spstr) in Any[(Fourier, "Fourier"), (CosSpace, "CosSpace"),
603+
(SinSpace, "SinSpace"), (Laurent, "Laurent"), (Taylor, "Taylor")]
604+
sp = spT()
605+
str = repr(sp)
606+
@test occursin(spstr, str)
607+
d = domain(sp)
608+
if d isa ApproxFunFourier.PeriodicSegment
609+
@test occursin(repr(leftendpoint(d)), str)
610+
@test occursin(repr(rightendpoint(d)), str)
611+
end
612+
end
613+
end

0 commit comments

Comments
 (0)