Skip to content

Split test macro to separate file #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 1 addition & 21 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,7 @@ end
@test reverseorientation(Arc(1,2,(0.1,0.2))) == Arc(1,2,(0.2,0.1))
end

function test_transform!(v, v2, S)
v .= rand.(eltype(v))
v2 .= v
@test itransform(S, transform(S, v)) ≈ v
@test transform(S, itransform(S, v)) ≈ v
transform!(S, v)
@test transform(S, v2) ≈ v
itransform!(S, v)
@test v2 ≈ v
end

macro verbose(ex)
head = ex.head
args = ex.args
@assert args[1] == Symbol("@testset")
name = args[3] isa String ? args[3] : nothing
if VERSION >= v"1.8"
insert!(args, 3, Expr(:(=), :verbose, true))
end
Expr(head, args...)
end
include("testutils.jl")

include("ClenshawTest.jl")
include("ChebyshevTest.jl")
Expand Down
26 changes: 26 additions & 0 deletions test/testutils.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using ApproxFunOrthogonalPolynomials
using LinearAlgebra
using Test

function test_transform!(v, v2, S)
v .= rand.(eltype(v))
v2 .= v
@test itransform(S, transform(S, v)) ≈ v
@test transform(S, itransform(S, v)) ≈ v
transform!(S, v)
@test transform(S, v2) ≈ v
itransform!(S, v)
@test v2 ≈ v
end

macro verbose(ex)
head = ex.head
args = ex.args
@assert args[1] == Symbol("@testset")
name = args[3] isa String ? args[3] : nothing
if VERSION >= v"1.8"
insert!(args, 3, Expr(:(=), :verbose, true))
end
Expr(head, args...)
end