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
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ updates:
- "/"
- "/docs"
- "/test"
- "/test/nopre"
- "/test/qa"
schedule:
interval: "daily"
groups:
Expand Down
19 changes: 1 addition & 18 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,5 @@ concurrency:

jobs:
tests:
name: "Tests"
strategy:
fail-fast: false
matrix:
version:
- "1"
- "lts"
- "pre"
group:
- Core
- nopre
exclude:
- version: "pre"
group: nopre
uses: "SciML/.github/.github/workflows/tests.yml@v1"
with:
julia-version: "${{ matrix.version }}"
group: "${{ matrix.group }}"
uses: "SciML/.github/.github/workflows/grouped-tests.yml@v1"
secrets: "inherit"
6 changes: 2 additions & 4 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
SparseBandedMatrices = "bd59d7e1-4699-4102-944e-d05209cb92aa"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
Aqua = "0.8"
LinearAlgebra = "1"
Pkg = "1"
Random = "1"
SafeTestsets = "0.1"
SciMLTesting = "1"
SparseBandedMatrices = "1.3.0"
Test = "1"
14 changes: 14 additions & 0 deletions test/constructors.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using SparseBandedMatrices
using Test

@testset "Constructors" begin
A = SparseBandedMatrix{Float64}(undef, 5, 5)
A[1, 1] = 2
@test A[1, 1] == 2.0
A[4, 1] = 0
@test A[4, 1] == 0.0
A[1, 3] = 5
@test A[1, 3] == 5.0

@test size(A) == (5, 5)
end
33 changes: 33 additions & 0 deletions test/division.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using SparseBandedMatrices, Random
using Test

@testset "Division" begin
dim = 5000
x = rand(10:75)
diag_vals = Vector{Vector{Float64}}(undef, x)
diag_locs = randperm(dim * 2 - 1)[1:x]
for j in 1:x
diag_vals[j] = rand(min(diag_locs[j], 2 * dim - diag_locs[j]))
end

x_butterfly = SparseBandedMatrix{Float64}(diag_locs, diag_vals, dim, dim)
x_dense = copy(x_butterfly)

y = rand(dim, dim)
z = zeros(dim, dim)

@test isapprox(x_dense / y, x_butterfly / y)
@test isapprox(y / x_dense, y / x_butterfly)

y = rand(10:75)
diag_vals = Vector{Vector{Float64}}(undef, y)
diag_locs = randperm(dim * 2 - 1)[1:y]
for j in 1:y
diag_vals[j] = rand(min(diag_locs[j], 2 * dim - diag_locs[j]))
end

y_butterfly = SparseBandedMatrix{Float64}(diag_locs, diag_vals, dim, dim)
y_dense = copy(y_butterfly)

@test isapprox(x_butterfly / y_butterfly, x_dense / y_dense)
end
33 changes: 33 additions & 0 deletions test/multiplication.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using SparseBandedMatrices, Random
using Test

@testset "Multiplication" begin
dim = 5000
x = rand(10:75)
diag_vals = Vector{Vector{Float64}}(undef, x)
diag_locs = randperm(dim * 2 - 1)[1:x]
for j in 1:x
diag_vals[j] = rand(min(diag_locs[j], 2 * dim - diag_locs[j]))
end

x_butterfly = SparseBandedMatrix{Float64}(diag_locs, diag_vals, dim, dim)
x_dense = copy(x_butterfly)

y = rand(dim, dim)
z = zeros(dim, dim)

@test isapprox(x_dense * y, x_butterfly * y)
@test isapprox(y * x_dense, y * x_butterfly)

y = rand(10:75)
diag_vals = Vector{Vector{Float64}}(undef, y)
diag_locs = randperm(dim * 2 - 1)[1:y]
for j in 1:y
diag_vals[j] = rand(min(diag_locs[j], 2 * dim - diag_locs[j]))
end

y_butterfly = SparseBandedMatrix{Float64}(diag_locs, diag_vals, dim, dim)
y_dense = copy(y_butterfly)

@test isapprox(x_butterfly * y_butterfly, x_dense * y_dense)
end
5 changes: 0 additions & 5 deletions test/nopre/runtests.jl

This file was deleted.

4 changes: 0 additions & 4 deletions test/qa.jl

This file was deleted.

11 changes: 10 additions & 1 deletion test/nopre/Project.toml → test/qa/Project.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
SparseBandedMatrices = "bd59d7e1-4699-4102-944e-d05209cb92aa"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
SparseBandedMatrices = {path = "../.."}

[compat]
Aqua = "0.8"
JET = "0.9, 0.10, 0.11"
LinearAlgebra = "1"
SparseBandedMatrices = "1.3.0"
SafeTestsets = "0.1"
SciMLTesting = "1"
Test = "1"
julia = "1.10"
6 changes: 5 additions & 1 deletion test/nopre/jet.jl → test/qa/qa.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using SparseBandedMatrices, JET, LinearAlgebra
using SparseBandedMatrices, Aqua, JET, LinearAlgebra, Test

@testset "Aqua" begin
Aqua.test_all(SparseBandedMatrices; ambiguities = (recursive = false,))
end

@testset "JET static analysis" begin
# Test that there are no unresolved dispatch errors in key functions
Expand Down
97 changes: 2 additions & 95 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,95 +1,2 @@
using SafeTestsets, Test, Pkg

const GROUP = get(ENV, "GROUP", "All")

@testset "SparseBandedMatrices" begin
if GROUP == "All" || GROUP == "Core"
@safetestset "Quality Assurance" include("qa.jl")
@safetestset "Interface Compatibility" include("interface.jl")

@safetestset "Constructors" begin
using SparseBandedMatrices

A = SparseBandedMatrix{Float64}(undef, 5, 5)
A[1, 1] = 2
@test A[1, 1] == 2.0
A[4, 1] = 0
@test A[4, 1] == 0.0
A[1, 3] = 5
@test A[1, 3] == 5.0

@test size(A) == (5, 5)
end

@safetestset "Multiplication" begin
using SparseBandedMatrices, Random
dim = 5000
x = rand(10:75)
diag_vals = Vector{Vector{Float64}}(undef, x)
diag_locs = randperm(dim * 2 - 1)[1:x]
for j in 1:x
diag_vals[j] = rand(min(diag_locs[j], 2 * dim - diag_locs[j]))
end

x_butterfly = SparseBandedMatrix{Float64}(diag_locs, diag_vals, dim, dim)
x_dense = copy(x_butterfly)

y = rand(dim, dim)
z = zeros(dim, dim)

@test isapprox(x_dense * y, x_butterfly * y)
@test isapprox(y * x_dense, y * x_butterfly)

y = rand(10:75)
diag_vals = Vector{Vector{Float64}}(undef, y)
diag_locs = randperm(dim * 2 - 1)[1:y]
for j in 1:y
diag_vals[j] = rand(min(diag_locs[j], 2 * dim - diag_locs[j]))
end

y_butterfly = SparseBandedMatrix{Float64}(diag_locs, diag_vals, dim, dim)
y_dense = copy(y_butterfly)

@test isapprox(x_butterfly * y_butterfly, x_dense * y_dense)
end

@safetestset "Division" begin
using SparseBandedMatrices, Random
dim = 5000
x = rand(10:75)
diag_vals = Vector{Vector{Float64}}(undef, x)
diag_locs = randperm(dim * 2 - 1)[1:x]
for j in 1:x
diag_vals[j] = rand(min(diag_locs[j], 2 * dim - diag_locs[j]))
end

x_butterfly = SparseBandedMatrix{Float64}(diag_locs, diag_vals, dim, dim)
x_dense = copy(x_butterfly)

y = rand(dim, dim)
z = zeros(dim, dim)

@test isapprox(x_dense / y, x_butterfly / y)
@test isapprox(y / x_dense, y / x_butterfly)

y = rand(10:75)
diag_vals = Vector{Vector{Float64}}(undef, y)
diag_locs = randperm(dim * 2 - 1)[1:y]
for j in 1:y
diag_vals[j] = rand(min(diag_locs[j], 2 * dim - diag_locs[j]))
end

y_butterfly = SparseBandedMatrix{Float64}(diag_locs, diag_vals, dim, dim)
y_dense = copy(y_butterfly)

@test isapprox(x_butterfly / y_butterfly, x_dense / y_dense)
end
end

if GROUP == "All" || GROUP == "nopre"
Pkg.activate(joinpath(@__DIR__, "nopre"))
Pkg.develop(PackageSpec(path = joinpath(@__DIR__, "..")))
Pkg.instantiate()
@safetestset "JET Static Analysis" include("nopre/jet.jl")
end
end
using SciMLTesting
run_tests()
5 changes: 5 additions & 0 deletions test/test_groups.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Core]
versions = ["lts", "1", "pre"]

[QA]
versions = ["lts", "1"]
Loading