File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ Suite of tests that may be used for all packages inheriting from MatrixAlgebraKi
88"""
99module TestSuite
1010
11+ using Test, TestExtras
12+ using MatrixAlgebraKit
13+ using MatrixAlgebraKit: diagview
14+ using LinearAlgebra: norm, istriu
15+
1116const tests = Dict ()
1217
1318macro testsuite (name, ex)
@@ -20,6 +25,25 @@ macro testsuite(name, ex)
2025 end
2126end
2227
28+ testargs_summary (args... ) = string (args)
29+
30+ instantiate_matrix (:: Type{T} , size) where {T <: Number } = randn (T, size)
31+ instantiate_matrix (:: Type{AT} , size) where {AT <: Array } = randn (eltype (AT), size)
32+
33+ function has_positive_diagonal (A)
34+ T = eltype (A)
35+ return if T <: Real
36+ all (≥ (zero (T)), diagview (A))
37+ else
38+ all (≥ (zero (real (T))), real (diagview (A))) &&
39+ all (≈ (zero (real (T))), imag (diagview (A)))
40+ end
41+ end
42+ isleftnull (N, A; kwargs... ) = isapprox (norm (N' * A), 0 ; kwargs... )
43+
44+ # TODO : actually make this a test
45+ macro testinferred (ex)
46+ return esc (:(@inferred $ ex))
2347end
2448
2549end
You can’t perform that action at this time.
0 commit comments