Skip to content

Commit 169650e

Browse files
authored
Split test macro to separate file (#146)
1 parent 6a2238c commit 169650e

File tree

2 files changed

+27
-21
lines changed

2 files changed

+27
-21
lines changed

test/runtests.jl

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,7 @@ end
1111
@test reverseorientation(Arc(1,2,(0.1,0.2))) == Arc(1,2,(0.2,0.1))
1212
end
1313

14-
function test_transform!(v, v2, S)
15-
v .= rand.(eltype(v))
16-
v2 .= v
17-
@test itransform(S, transform(S, v)) v
18-
@test transform(S, itransform(S, v)) v
19-
transform!(S, v)
20-
@test transform(S, v2) v
21-
itransform!(S, v)
22-
@test v2 v
23-
end
24-
25-
macro verbose(ex)
26-
head = ex.head
27-
args = ex.args
28-
@assert args[1] == Symbol("@testset")
29-
name = args[3] isa String ? args[3] : nothing
30-
if VERSION >= v"1.8"
31-
insert!(args, 3, Expr(:(=), :verbose, true))
32-
end
33-
Expr(head, args...)
34-
end
14+
include("testutils.jl")
3515

3616
include("ClenshawTest.jl")
3717
include("ChebyshevTest.jl")

test/testutils.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using ApproxFunOrthogonalPolynomials
2+
using LinearAlgebra
3+
using Test
4+
5+
function test_transform!(v, v2, S)
6+
v .= rand.(eltype(v))
7+
v2 .= v
8+
@test itransform(S, transform(S, v)) v
9+
@test transform(S, itransform(S, v)) v
10+
transform!(S, v)
11+
@test transform(S, v2) v
12+
itransform!(S, v)
13+
@test v2 v
14+
end
15+
16+
macro verbose(ex)
17+
head = ex.head
18+
args = ex.args
19+
@assert args[1] == Symbol("@testset")
20+
name = args[3] isa String ? args[3] : nothing
21+
if VERSION >= v"1.8"
22+
insert!(args, 3, Expr(:(=), :verbose, true))
23+
end
24+
Expr(head, args...)
25+
end
26+

0 commit comments

Comments
 (0)