Skip to content

Commit b265fea

Browse files
authored
Move testhelpers over from julia repo (#1371)
This makes it easier to keep the test helpers in sync with the code changes in this repo, and also makes it easier to add tests.
1 parent 9a429fe commit b265fea

24 files changed

+1446
-56
lines changed

test/adjtrans.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ isdefined(Main, :pruned_old_LA) || @eval Main include("prune_old_LA.jl")
66

77
using Test, LinearAlgebra
88

9-
const BASE_TEST_PATH = joinpath(Sys.BINDIR, "..", "share", "julia", "test")
9+
const BASE_TEST_PATH = joinpath(dirname(pathof(LinearAlgebra)), "..", "test")
10+
const TESTHELPERS = joinpath(BASE_TEST_PATH, "testhelpers")
1011

11-
isdefined(Main, :OffsetArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "OffsetArrays.jl"))
12+
isdefined(Main, :OffsetArrays) || @eval Main include(joinpath($TESTHELPERS, "OffsetArrays.jl"))
1213
using .Main.OffsetArrays
1314

14-
isdefined(Main, :ImmutableArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "ImmutableArrays.jl"))
15+
isdefined(Main, :ImmutableArrays) || @eval Main include(joinpath($TESTHELPERS, "ImmutableArrays.jl"))
1516
using .Main.ImmutableArrays
1617

1718
@testset "Adjoint and Transpose inner constructor basics" begin

test/bidiag.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,25 @@ isdefined(Main, :pruned_old_LA) || @eval Main include("prune_old_LA.jl")
77
using Test, LinearAlgebra, Random
88
using LinearAlgebra: BlasReal, BlasFloat
99

10-
const BASE_TEST_PATH = joinpath(Sys.BINDIR, "..", "share", "julia", "test")
10+
const BASE_TEST_PATH = joinpath(dirname(pathof(LinearAlgebra)), "..", "test")
11+
const TESTHELPERS = joinpath(BASE_TEST_PATH, "testhelpers")
1112

12-
isdefined(Main, :Quaternions) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "Quaternions.jl"))
13+
isdefined(Main, :Quaternions) || @eval Main include(joinpath($TESTHELPERS, "Quaternions.jl"))
1314
using .Main.Quaternions
1415

15-
isdefined(Main, :InfiniteArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "InfiniteArrays.jl"))
16+
isdefined(Main, :InfiniteArrays) || @eval Main include(joinpath($TESTHELPERS, "InfiniteArrays.jl"))
1617
using .Main.InfiniteArrays
1718

18-
isdefined(Main, :FillArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "FillArrays.jl"))
19+
isdefined(Main, :FillArrays) || @eval Main include(joinpath($TESTHELPERS, "FillArrays.jl"))
1920
using .Main.FillArrays
2021

21-
isdefined(Main, :OffsetArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "OffsetArrays.jl"))
22+
isdefined(Main, :OffsetArrays) || @eval Main include(joinpath($TESTHELPERS, "OffsetArrays.jl"))
2223
using .Main.OffsetArrays
2324

24-
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "SizedArrays.jl"))
25+
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($TESTHELPERS, "SizedArrays.jl"))
2526
using .Main.SizedArrays
2627

27-
isdefined(Main, :ImmutableArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "ImmutableArrays.jl"))
28+
isdefined(Main, :ImmutableArrays) || @eval Main include(joinpath($TESTHELPERS, "ImmutableArrays.jl"))
2829
using .Main.ImmutableArrays
2930

3031
include("testutils.jl") # test_approx_eq_modphase

test/cholesky.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ using Test, LinearAlgebra, Random
88
using LinearAlgebra: BlasComplex, BlasFloat, BlasReal, QRPivoted,
99
PosDefException, RankDeficientException, chkfullrank
1010

11-
const BASE_TEST_PATH = joinpath(Sys.BINDIR, "..", "share", "julia", "test")
11+
const BASE_TEST_PATH = joinpath(dirname(pathof(LinearAlgebra)), "..", "test")
12+
const TESTHELPERS = joinpath(BASE_TEST_PATH, "testhelpers")
1213

13-
isdefined(Main, :Quaternions) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "Quaternions.jl"))
14+
isdefined(Main, :Quaternions) || @eval Main include(joinpath($TESTHELPERS, "Quaternions.jl"))
1415
using .Main.Quaternions
1516

1617
function unary_ops_tests(a, ca, tol; n=size(a, 1))

test/dense.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ using Test, LinearAlgebra, Random
88
using LinearAlgebra: BlasComplex, BlasFloat, BlasReal
99
using Test: GenericArray
1010

11-
const BASE_TEST_PATH = joinpath(Sys.BINDIR, "..", "share", "julia", "test")
12-
isdefined(Main, :FillArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "FillArrays.jl"))
11+
const BASE_TEST_PATH = joinpath(dirname(pathof(LinearAlgebra)), "..", "test")
12+
const TESTHELPERS = joinpath(BASE_TEST_PATH, "testhelpers")
13+
14+
isdefined(Main, :FillArrays) || @eval Main include(joinpath($TESTHELPERS, "FillArrays.jl"))
1315
import Main.FillArrays
1416

15-
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "SizedArrays.jl"))
17+
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($TESTHELPERS, "SizedArrays.jl"))
1618
using Main.SizedArrays
1719

1820
@testset "Check that non-floats are correctly promoted" begin

test/diagonal.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,22 @@ isdefined(Main, :pruned_old_LA) || @eval Main include("prune_old_LA.jl")
77
using Test, LinearAlgebra, Random
88
using LinearAlgebra: BlasFloat, BlasComplex
99

10-
const BASE_TEST_PATH = joinpath(Sys.BINDIR, "..", "share", "julia", "test")
10+
const BASE_TEST_PATH = joinpath(dirname(pathof(LinearAlgebra)), "..", "test")
11+
const TESTHELPERS = joinpath(BASE_TEST_PATH, "testhelpers")
1112

12-
isdefined(Main, :OffsetArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "OffsetArrays.jl"))
13+
isdefined(Main, :OffsetArrays) || @eval Main include(joinpath($TESTHELPERS, "OffsetArrays.jl"))
1314
using .Main.OffsetArrays
1415

15-
isdefined(Main, :InfiniteArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "InfiniteArrays.jl"))
16+
isdefined(Main, :InfiniteArrays) || @eval Main include(joinpath($TESTHELPERS, "InfiniteArrays.jl"))
1617
using .Main.InfiniteArrays
1718

18-
isdefined(Main, :FillArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "FillArrays.jl"))
19+
isdefined(Main, :FillArrays) || @eval Main include(joinpath($TESTHELPERS, "FillArrays.jl"))
1920
using .Main.FillArrays
2021

21-
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "SizedArrays.jl"))
22+
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($TESTHELPERS, "SizedArrays.jl"))
2223
using .Main.SizedArrays
2324

24-
isdefined(Main, :ImmutableArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "ImmutableArrays.jl"))
25+
isdefined(Main, :ImmutableArrays) || @eval Main include(joinpath($TESTHELPERS, "ImmutableArrays.jl"))
2526
using .Main.ImmutableArrays
2627

2728
const n=12 # Size of matrix problem to test

test/generic.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,22 @@ using Test, LinearAlgebra, Random
88
using Test: GenericArray
99
using LinearAlgebra: isbanded
1010

11-
const BASE_TEST_PATH = joinpath(Sys.BINDIR, "..", "share", "julia", "test")
11+
const BASE_TEST_PATH = joinpath(dirname(pathof(LinearAlgebra)), "..", "test")
12+
const TESTHELPERS = joinpath(BASE_TEST_PATH, "testhelpers")
1213

13-
isdefined(Main, :Quaternions) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "Quaternions.jl"))
14+
isdefined(Main, :Quaternions) || @eval Main include(joinpath($TESTHELPERS, "Quaternions.jl"))
1415
using .Main.Quaternions
1516

16-
isdefined(Main, :OffsetArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "OffsetArrays.jl"))
17+
isdefined(Main, :OffsetArrays) || @eval Main include(joinpath($TESTHELPERS, "OffsetArrays.jl"))
1718
using .Main.OffsetArrays
1819

19-
isdefined(Main, :DualNumbers) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "DualNumbers.jl"))
20+
isdefined(Main, :DualNumbers) || @eval Main include(joinpath($TESTHELPERS, "DualNumbers.jl"))
2021
using .Main.DualNumbers
2122

22-
isdefined(Main, :FillArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "FillArrays.jl"))
23+
isdefined(Main, :FillArrays) || @eval Main include(joinpath($TESTHELPERS, "FillArrays.jl"))
2324
using .Main.FillArrays
2425

25-
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "SizedArrays.jl"))
26+
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($TESTHELPERS, "SizedArrays.jl"))
2627
using .Main.SizedArrays
2728

2829
Random.seed!(123)

test/hessenberg.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ isdefined(Main, :pruned_old_LA) || @eval Main include("prune_old_LA.jl")
66

77
using Test, LinearAlgebra, Random
88

9-
const BASE_TEST_PATH = joinpath(Sys.BINDIR, "..", "share", "julia", "test")
10-
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "SizedArrays.jl"))
9+
const BASE_TEST_PATH = joinpath(dirname(pathof(LinearAlgebra)), "..", "test")
10+
const TESTHELPERS = joinpath(BASE_TEST_PATH, "testhelpers")
11+
12+
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($TESTHELPERS, "SizedArrays.jl"))
1113
using .Main.SizedArrays
1214

13-
isdefined(Main, :ImmutableArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "ImmutableArrays.jl"))
15+
isdefined(Main, :ImmutableArrays) || @eval Main include(joinpath($TESTHELPERS, "ImmutableArrays.jl"))
1416
using .Main.ImmutableArrays
1517

1618
# for tuple tests below

test/matmul.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ using Base: rtoldefault
88
using Test, LinearAlgebra, Random
99
using LinearAlgebra: mul!, Symmetric, Hermitian
1010

11-
const BASE_TEST_PATH = joinpath(Sys.BINDIR, "..", "share", "julia", "test")
11+
const BASE_TEST_PATH = joinpath(dirname(pathof(LinearAlgebra)), "..", "test")
12+
const TESTHELPERS = joinpath(BASE_TEST_PATH, "testhelpers")
1213

13-
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "SizedArrays.jl"))
14+
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($TESTHELPERS, "SizedArrays.jl"))
1415
using .Main.SizedArrays
1516

1617
## Test Julia fallbacks to BLAS routines

test/special.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ isdefined(Main, :pruned_old_LA) || @eval Main include("prune_old_LA.jl")
77
using Test, LinearAlgebra, Random
88
using LinearAlgebra: rmul!, BandIndex
99

10-
const BASE_TEST_PATH = joinpath(Sys.BINDIR, "..", "share", "julia", "test")
11-
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "SizedArrays.jl"))
10+
const BASE_TEST_PATH = joinpath(dirname(pathof(LinearAlgebra)), "..", "test")
11+
const TESTHELPERS = joinpath(BASE_TEST_PATH, "testhelpers")
12+
13+
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($TESTHELPERS, "SizedArrays.jl"))
1214
using .Main.SizedArrays
1315

1416
n= 10 #Size of matrix to test

test/structuredbroadcast.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ isdefined(Main, :pruned_old_LA) || @eval Main include("prune_old_LA.jl")
66

77
using Test, LinearAlgebra
88

9-
const BASE_TEST_PATH = joinpath(Sys.BINDIR, "..", "share", "julia", "test")
10-
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "SizedArrays.jl"))
9+
const BASE_TEST_PATH = joinpath(dirname(pathof(LinearAlgebra)), "..", "test")
10+
const TESTHELPERS = joinpath(BASE_TEST_PATH, "testhelpers")
11+
12+
isdefined(Main, :SizedArrays) || @eval Main include(joinpath($TESTHELPERS, "SizedArrays.jl"))
1113
using .Main.SizedArrays
1214

1315
@testset "broadcast[!] over combinations of scalars, structured matrices, and dense vectors/matrices" begin

0 commit comments

Comments
 (0)