diff --git a/test/Project.toml b/test/Project.toml index 351c06d..6b01067 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,5 +1,6 @@ [deps] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" diff --git a/test/jet.jl b/test/jet.jl new file mode 100644 index 0000000..7ef397d --- /dev/null +++ b/test/jet.jl @@ -0,0 +1,28 @@ +using SparseBandedMatrices, JET, LinearAlgebra + +@testset "JET static analysis" begin + # Test that there are no unresolved dispatch errors in key functions + @testset "Error-free analysis" begin + rep = JET.report_call(getindex, (SparseBandedMatrix{Float64}, Int, Int)) + @test length(JET.get_reports(rep)) == 0 + + rep = JET.report_call(setindex!, (SparseBandedMatrix{Float64}, Float64, Int, Int)) + @test length(JET.get_reports(rep)) == 0 + + rep = JET.report_call(size, (SparseBandedMatrix{Float64},)) + @test length(JET.get_reports(rep)) == 0 + + rep = JET.report_call(setdiagonal!, (SparseBandedMatrix{Float64}, Vector{Float64}, Bool)) + @test length(JET.get_reports(rep)) == 0 + end + + @testset "Type stability for core operations" begin + # Test getindex type stability + rep = JET.report_opt(getindex, (SparseBandedMatrix{Float64}, Int, Int)) + @test length(JET.get_reports(rep)) == 0 + + # Test size type stability + rep = JET.report_opt(size, (SparseBandedMatrix{Float64},)) + @test length(JET.get_reports(rep)) == 0 + end +end diff --git a/test/runtests.jl b/test/runtests.jl index af3a211..1adeb88 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,6 +2,7 @@ using SafeTestsets, Test @testset "SparseBandedMatrices" begin @safetestset "Quality Assurance" include("qa.jl") + @safetestset "JET Static Analysis" include("jet.jl") @safetestset "Constructors" begin using SparseBandedMatrices