Skip to content
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
15 changes: 3 additions & 12 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ FillArrays = "1.11"
Images = "0.26"
LinearAlgebra = "1"
OffsetArrays = "1.0"
ParallelTestRunner = "2"
Random = "1"
SparseArrays = "1"
StaticArrays = "1"
Expand All @@ -40,21 +41,11 @@ BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
ParallelTestRunner = "d3525ed8-44d0-4b2c-a655-542cee43accc"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = [
"Adapt",
"Aqua",
"BandedMatrices",
"Documenter",
"Images",
"OffsetArrays",
"SparseArrays",
"StaticArrays",
"Test",
"Random",
]
test = ["Adapt", "Aqua", "BandedMatrices", "Documenter", "Images", "OffsetArrays", "ParallelTestRunner", "SparseArrays", "StaticArrays", "Test", "Random"]
39 changes: 11 additions & 28 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
using BlockArrays, LinearAlgebra, Test
using BlockArrays
using ParallelTestRunner

using Aqua
downstream_test = "--downstream_integration_test" in ARGS
@testset "Project quality" begin
Aqua.test_all(BlockArrays, ambiguities=false,
stale_deps=!downstream_test)
end
# Start with autodiscovered tests
testsuite = find_tests(pwd())

using Documenter
@testset "docstrings" begin
# don't test docstrings on old versions to avoid failures due to changes in types
if v"1.10" <= VERSION < v"1.11.0-"
DocMeta.setdocmeta!(BlockArrays, :DocTestSetup, :(using BlockArrays); recursive=true)
doctest(BlockArrays, manual=false)
end
if "--downstream_integration_test" in ARGS
delete!(testsuite, "test_aqua")
end

include("test_blockindices.jl")
include("test_blockarrays.jl")
include("test_blockviews.jl")
include("test_blocks.jl")
include("test_blockrange.jl")
include("test_blockarrayinterface.jl")
include("test_blockbroadcast.jl")
include("test_blocklinalg.jl")
include("test_blockproduct.jl")
include("test_blockreduce.jl")
include("test_blockdeque.jl")
include("test_blockcholesky.jl")
include("test_blockbanded.jl")
include("test_adapt.jl")
filtered_args = filter(!=("--downstream_integration_test"), ARGS)
# Parse arguments
args = parse_args(filtered_args)

runtests(BlockArrays, args; testsuite)
11 changes: 11 additions & 0 deletions test/test_aqua.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module AquaTest

using BlockArrays
using Test
import Aqua

@testset "Project quality" begin
Aqua.test_all(BlockArrays, ambiguities=false)
end

end
8 changes: 4 additions & 4 deletions test/test_blockindices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ import BlockArrays: split_index, merge_indices
@test sprint(show, "text/plain", Block{1}(1)) == "Block(1)"
@test sprint(show, "text/plain", Block{2}(1,2)) == "Block(1, 2)"

@test sprint(show, "text/plain", Block{0,BigInt}()) == "Block{0, BigInt}()"
@test sprint(show, "text/plain", Block{1,BigInt}(1)) == "Block{1, BigInt}(1)"
@test sprint(show, "text/plain", Block{0,BigInt}()) == "$Block{0, BigInt}()"
@test sprint(show, "text/plain", Block{1,BigInt}(1)) == "$Block{1, BigInt}(1)"
@test sprint(show, "text/plain", Block{2}(1,2)) == "Block(1, 2)"

@test sprint(show, "text/plain", BlockIndex((1,2), (3,4))) == "Block(1, 2)[3, 4]"
Expand Down Expand Up @@ -398,7 +398,7 @@ end
@test Base.dataids(b) == Base.dataids(blocklasts(b))
@test_throws ArgumentError BlockedUnitRange(b)

@test summary(b) == "3-blocked 6-element BlockedUnitRange{$Int, Vector{$Int}}"
@test summary(b) == "3-blocked 6-element $BlockedUnitRange{$Int, Vector{$Int}}"
end

@testset "OneTo interface" begin
Expand Down Expand Up @@ -680,7 +680,7 @@ end
@test Base.dataids(b) == Base.dataids(blocklasts(b))
@test_throws ArgumentError BlockedOneTo(b)

@test summary(b) == "3-blocked 6-element BlockedOneTo{$Int, Vector{$Int}}"
@test summary(b) == "3-blocked 6-element $BlockedOneTo{$Int, Vector{$Int}}"
end

@testset "OneTo interface" begin
Expand Down
10 changes: 3 additions & 7 deletions test/test_blockviews.jl
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,9 @@ bview(a, b) = Base.invoke(view, Tuple{AbstractArray,Any}, a, b)
@test blocks(V) == blocks(A)[1:1,1:2]
@test blocks(W) == blocks(A)[1:2,1:1]
Vi = parentindices(V)
@test sprint(show, "text/plain", V) == "1×3 view(::BlockMatrix{$Int, Matrix{Matrix{$Int}}, "*
"$(typeof(axes(A)))}, $(Vi[1]), $(Vi[2])) "*
"with eltype $Int with indices $(axes(V,1))×$(axes(V,2)):\n 1 │ 2 3"
@test sprint(show, "text/plain", V) == "$(summary(V)):\n 1 │ 2 3"
Wi = parentindices(W)
@test sprint(show, "text/plain", W) == "3×1 view(::BlockMatrix{$Int, Matrix{Matrix{$Int}}"*
", $(typeof(axes(A)))}, $(Wi[1]), $(Wi[2])) "*
"with eltype $Int with indices $(axes(W,1))×$(axes(W,2)):\n 1\n ─\n 4\n 7"
@test sprint(show, "text/plain", W) == "$(summary(W)):\n 1\n ─\n 4\n 7"
end

@testset "getindex with BlockRange" begin
Expand Down Expand Up @@ -395,7 +391,7 @@ bview(a, b) = Base.invoke(view, Tuple{AbstractArray,Any}, a, b)
end
bl = BlockedLogicalIndex(BlockedVector([true, true, false, false, true, false], [3, 3]))
@test sprint(show, "text/plain", bl) ==
"2-blocked 3-element BlockedVector{Int64, Base.LogicalIndex{Int64, BlockedVector{Bool, Vector{Bool}, Tuple{BlockedOneTo{Int64, Vector{Int64}}}}}, Tuple{BlockedOneTo{Int64, Vector{Int64}}}}:\n 1\n 2\n ─\n 5"
"$(summary(bl)):\n 1\n 2\n ─\n 5"
@test checkbounds(Bool, randn(6), bl)
@test !checkbounds(Bool, randn(5), bl)
@test checkindex(Bool, 1:6, bl)
Expand Down
15 changes: 15 additions & 0 deletions test/test_docstrings.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module DocstringsTest

using Documenter
using Test
import BlockArrays

@testset "docstrings" begin
# don't test docstrings on old versions to avoid failures due to changes in types
if v"1.10" <= VERSION < v"1.11.0-"
DocMeta.setdocmeta!(BlockArrays, :DocTestSetup, :(using BlockArrays); recursive=true)
doctest(BlockArrays, manual=false)
end
end

end
Loading